home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX 2e document text
| default
| |
99%
| file
| LaTeX document text
| default
| |
98%
| file
| C source text
| default
| |
97%
| file
| LaTeX document, ASCII text
| default
| |
100%
| TrID
| LaTeX 2e document
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/280 LaTeX (Master document)
| default
| |
100%
| detectItEasy
| Format: plain text[LF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 64 6f 63 75 6d 65 6e | 74 63 6c 61 73 73 5b 31 |\documen|tclass[1|
|00000010| 31 70 74 5d 7b 61 72 74 | 69 63 6c 65 7d 0a 5c 75 |1pt]{art|icle}.\u|
|00000020| 73 65 70 61 63 6b 61 67 | 65 7b 66 75 6c 6c 70 61 |sepackag|e{fullpa|
|00000030| 67 65 7d 0a 25 5c 75 73 | 65 70 61 63 6b 61 67 65 |ge}.%\us|epackage|
|00000040| 7b 70 61 6c 61 74 69 6e | 6f 7d 0a 5c 75 73 65 70 |{palatin|o}.\usep|
|00000050| 61 63 6b 61 67 65 7b 70 | 73 66 69 67 7d 0a 0a 5c |ackage{p|sfig}..\|
|00000060| 74 69 74 6c 65 7b 54 68 | 65 20 4d 50 45 47 20 4c |title{Th|e MPEG L|
|00000070| 69 62 72 61 72 79 5c 5c | 0a 20 20 20 20 20 20 20 |ibrary\\|. |
|00000080| 56 65 72 73 69 6f 6e 20 | 31 2e 32 7d 0a 5c 61 75 |Version |1.2}.\au|
|00000090| 74 68 6f 72 7b 47 72 65 | 67 20 57 61 72 64 5c 5c |thor{Gre|g Ward\\|
|000000a0| 28 7b 5c 74 74 20 67 72 | 65 67 40 70 65 74 2e 6d |({\tt gr|eg@pet.m|
|000000b0| 6e 69 2e 6d 63 67 69 6c | 6c 2e 63 61 7d 29 7d 0a |ni.mcgil|l.ca})}.|
|000000c0| 0a 25 5c 72 65 6e 65 77 | 63 6f 6d 6d 61 6e 64 7b |.%\renew|command{|
|000000d0| 5c 66 61 6d 69 6c 79 64 | 65 66 61 75 6c 74 7d 7b |\familyd|efault}{|
|000000e0| 63 6d 73 73 7d 0a 25 5c | 72 65 6e 65 77 63 6f 6d |cmss}.%\|renewcom|
|000000f0| 6d 61 6e 64 7b 5c 62 66 | 64 65 66 61 75 6c 74 7d |mand{\bf|default}|
|00000100| 7b 62 7d 20 20 20 25 20 | 6d 61 6b 65 20 60 60 62 |{b} % |make ``b|
|00000110| 6f 6c 64 27 27 20 63 6f | 6d 65 20 6f 75 74 20 6d |old'' co|me out m|
|00000120| 65 64 69 75 6d 2d 77 69 | 64 74 68 0a 0a 25 20 5c |edium-wi|dth..% \|
|00000130| 63 6f 64 65 20 2d 20 66 | 6f 72 20 74 79 70 65 73 |code - f|or types|
|00000140| 65 74 74 69 6e 67 20 61 | 20 6c 69 74 74 6c 65 20 |etting a| little |
|00000150| 62 69 74 20 6f 66 20 63 | 6f 6d 70 75 74 65 72 20 |bit of c|omputer |
|00000160| 63 6f 64 65 20 28 69 6e | 20 74 79 70 65 77 72 69 |code (in| typewri|
|00000170| 74 65 72 20 66 6f 6e 74 | 29 0a 5c 6e 65 77 63 6f |ter font|).\newco|
|00000180| 6d 6d 61 6e 64 7b 5c 63 | 6f 64 65 7d 5b 31 5d 7b |mmand{\c|ode}[1]{|
|00000190| 5c 74 65 78 74 74 74 7b | 23 31 7d 7d 0a 0a 0a 25 |\texttt{|#1}}...%|
|000001a0| 20 74 74 64 65 73 63 72 | 69 70 74 69 6f 6e 20 2d | ttdescr|iption -|
|000001b0| 20 61 20 64 65 73 63 72 | 69 70 74 69 6f 6e 2d 6c | a descr|iption-l|
|000001c0| 69 6b 65 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |ike envi|ronment |
|000001d0| 77 68 65 72 65 20 69 74 | 65 6d 20 64 65 73 63 72 |where it|em descr|
|000001e0| 69 70 74 69 6f 6e 73 20 | 61 72 65 0a 25 20 74 79 |iptions |are.% ty|
|000001f0| 70 65 73 65 74 20 75 73 | 69 6e 67 20 22 5c 74 74 |peset us|ing "\tt|
|00000200| 22 2c 20 66 6f 6c 6c 6f | 77 65 64 20 62 79 20 61 |", follo|wed by a|
|00000210| 20 63 6f 6c 6f 6e 0a 0a | 5c 6e 65 77 63 6f 6d 6d | colon..|\newcomm|
|00000220| 61 6e 64 7b 5c 74 74 6c | 61 62 65 6c 7d 5b 31 5d |and{\ttl|abel}[1]|
|00000230| 7b 5c 74 65 78 74 74 74 | 7b 23 31 3a 7d 5c 71 75 |{\texttt|{#1:}\qu|
|00000240| 61 64 5c 68 66 69 6c 7d | 0a 5c 6e 65 77 65 6e 76 |ad\hfil}|.\newenv|
|00000250| 69 72 6f 6e 6d 65 6e 74 | 7b 74 74 64 65 73 63 72 |ironment|{ttdescr|
|00000260| 69 70 74 69 6f 6e 7d 5b | 31 5d 20 7b 5c 6e 65 77 |iption}[|1] {\new|
|00000270| 62 6f 78 5c 68 6f 6c 64 | 65 72 0a 20 20 5c 73 65 |box\hold|er. \se|
|00000280| 74 62 6f 78 5c 68 6f 6c | 64 65 72 3d 5c 68 62 6f |tbox\hol|der=\hbo|
|00000290| 78 7b 5c 74 74 6c 61 62 | 65 6c 23 31 7d 20 5c 64 |x{\ttlab|el#1} \d|
|000002a0| 69 6d 65 6e 30 3d 5c 77 | 64 5c 68 6f 6c 64 65 72 |imen0=\w|d\holder|
|000002b0| 0a 20 5c 62 65 67 69 6e | 7b 6c 69 73 74 7d 7b 7d |. \begin|{list}{}|
|000002c0| 0a 20 20 20 7b 5c 6c 61 | 62 65 6c 73 65 70 3d 2d |. {\la|belsep=-|
|000002d0| 30 2e 32 35 69 6e 20 5c | 72 69 67 68 74 6d 61 72 |0.25in \|rightmar|
|000002e0| 67 69 6e 3d 30 2e 32 35 | 69 6e 20 5c 6c 65 66 74 |gin=0.25|in \left|
|000002f0| 6d 61 72 67 69 6e 3d 5c | 64 69 6d 65 6e 30 0a 20 |margin=\|dimen0. |
|00000300| 20 20 20 20 5c 61 64 64 | 74 6f 6c 65 6e 67 74 68 | \add|tolength|
|00000310| 7b 5c 6c 65 66 74 6d 61 | 72 67 69 6e 7d 7b 30 2e |{\leftma|rgin}{0.|
|00000320| 32 35 69 6e 7d 0a 20 20 | 5c 6c 61 62 65 6c 77 69 |25in}. |\labelwi|
|00000330| 64 74 68 3d 5c 6c 65 66 | 74 6d 61 72 67 69 6e 0a |dth=\lef|tmargin.|
|00000340| 20 20 5c 6c 65 74 5c 6d | 61 6b 65 6c 61 62 65 6c | \let\m|akelabel|
|00000350| 5c 74 74 6c 61 62 65 6c | 7d 7d 25 20 20 20 20 20 |\ttlabel|}}% |
|00000360| 74 68 69 73 20 63 6f 6d | 6d 65 6e 74 20 69 73 20 |this com|ment is |
|00000370| 6e 65 65 64 65 64 20 74 | 6f 20 68 69 64 65 20 74 |needed t|o hide t|
|00000380| 68 65 20 6e 65 77 6c 69 | 6e 65 0a 7b 5c 65 6e 64 |he newli|ne.{\end|
|00000390| 7b 6c 69 73 74 7d 7d 0a | 0a 25 20 5c 70 72 6f 74 |{list}}.|.% \prot|
|000003a0| 6f 74 79 70 65 20 2d 20 | 66 6f 72 20 74 79 70 65 |otype - |for type|
|000003b0| 73 65 74 74 69 6e 67 20 | 61 20 66 75 6e 63 74 69 |setting |a functi|
|000003c0| 6f 6e 20 70 72 6f 74 6f | 74 79 70 65 0a 5c 6e 65 |on proto|type.\ne|
|000003d0| 77 63 6f 6d 6d 61 6e 64 | 7b 5c 70 72 6f 74 6f 74 |wcommand|{\protot|
|000003e0| 79 70 65 7d 5b 31 5d 7b | 25 0a 20 20 5c 74 65 78 |ype}[1]{|%. \tex|
|000003f0| 74 62 66 7b 46 75 6e 63 | 74 69 6f 6e 20 70 72 6f |tbf{Func|tion pro|
|00000400| 74 6f 74 79 70 65 3a 7d | 5c 70 61 72 20 5c 73 6d |totype:}|\par \sm|
|00000410| 61 6c 6c 73 6b 69 70 20 | 5c 63 6f 64 65 7b 23 31 |allskip |\code{#1|
|00000420| 7d 5c 70 61 72 5c 6d 65 | 64 73 6b 69 70 20 7d 0a |}\par\me|dskip }.|
|00000430| 0a 5c 6e 65 77 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 |.\newenv|ironment|
|00000440| 7b 41 72 67 75 6d 65 6e | 74 73 7d 5b 31 5d 7b 25 |{Argumen|ts}[1]{%|
|00000450| 0a 5c 6e 6f 69 6e 64 65 | 6e 74 5c 74 65 78 74 62 |.\noinde|nt\textb|
|00000460| 66 7b 41 72 67 75 6d 65 | 6e 74 73 3a 7d 25 0a 5c |f{Argume|nts:}%.\|
|00000470| 62 65 67 69 6e 7b 74 74 | 64 65 73 63 72 69 70 74 |begin{tt|descript|
|00000480| 69 6f 6e 7d 7b 23 31 7d | 7d 0a 7b 5c 65 6e 64 7b |ion}{#1}|}.{\end{|
|00000490| 74 74 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 5c 6d |ttdescri|ption}\m|
|000004a0| 65 64 73 6b 69 70 7d 0a | 0a 5c 6e 65 77 65 6e 76 |edskip}.|.\newenv|
|000004b0| 69 72 6f 6e 6d 65 6e 74 | 7b 4e 6f 74 65 73 7d 7b |ironment|{Notes}{|
|000004c0| 25 0a 5c 6e 6f 69 6e 64 | 65 6e 74 5c 74 65 78 74 |%.\noind|ent\text|
|000004d0| 62 66 7b 4e 6f 74 65 73 | 3a 7d 5c 70 61 72 5c 73 |bf{Notes|:}\par\s|
|000004e0| 6d 61 6c 6c 73 6b 69 70 | 7d 0a 7b 5c 6d 65 64 73 |mallskip|}.{\meds|
|000004f0| 6b 69 70 7d 0a 0a 5c 62 | 65 67 69 6e 7b 64 6f 63 |kip}..\b|egin{doc|
|00000500| 75 6d 65 6e 74 7d 0a 0a | 5c 6d 61 6b 65 74 69 74 |ument}..|\maketit|
|00000510| 6c 65 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 49 6e 74 |le..\sec|tion{Int|
|00000520| 72 6f 64 75 63 74 69 6f | 6e 20 61 6e 64 20 42 61 |roductio|n and Ba|
|00000530| 63 6b 67 72 6f 75 6e 64 | 7d 0a 0a 54 68 65 20 4d |ckground|}..The M|
|00000540| 50 45 47 20 4c 69 62 72 | 61 72 79 20 69 73 20 62 |PEG Libr|ary is b|
|00000550| 61 73 65 64 20 6f 6e 20 | 61 6e 20 65 66 66 6f 72 |ased on |an effor|
|00000560| 74 20 66 72 6f 6d 20 74 | 68 65 20 55 6e 69 76 65 |t from t|he Unive|
|00000570| 72 73 69 74 79 20 6f 66 | 0a 43 61 6c 69 66 6f 72 |rsity of|.Califor|
|00000580| 6e 69 61 20 61 74 20 42 | 65 72 6b 65 6c 65 79 20 |nia at B|erkeley |
|00000590| 74 6f 20 63 72 65 61 74 | 65 20 61 20 70 6f 72 74 |to creat|e a port|
|000005a0| 61 62 6c 65 2c 20 73 6f | 66 74 77 61 72 65 2d 62 |able, so|ftware-b|
|000005b0| 61 73 65 64 20 4d 50 45 | 47 0a 64 65 63 6f 64 65 |ased MPE|G.decode|
|000005c0| 72 20 20 5c 63 69 74 65 | 7b 50 61 74 65 6c 39 33 |r \cite|{Patel93|
|000005d0| 7d 2e 20 20 54 68 69 73 | 20 72 65 73 75 6c 74 65 |}. This| resulte|
|000005e0| 64 20 69 6e 20 74 68 65 | 20 77 69 64 65 6c 79 20 |d in the| widely |
|000005f0| 64 69 73 74 72 69 62 75 | 74 65 64 20 28 61 6e 64 |distribu|ted (and|
|00000600| 0a 77 69 64 65 6c 79 20 | 6d 6f 64 69 66 69 65 64 |.widely |modified|
|00000610| 29 20 5c 63 6f 64 65 7b | 6d 70 65 67 5c 5f 70 6c |) \code{|mpeg\_pl|
|00000620| 61 79 7d 2c 20 61 20 68 | 69 67 68 6c 79 2d 6f 70 |ay}, a h|ighly-op|
|00000630| 74 69 6d 69 7a 65 64 20 | 4d 50 45 47 20 64 65 63 |timized |MPEG dec|
|00000640| 6f 64 65 72 0a 74 68 61 | 74 20 77 61 73 20 73 70 |oder.tha|t was sp|
|00000650| 65 63 69 66 69 63 61 6c | 6c 79 20 67 65 61 72 65 |ecifical|ly geare|
|00000660| 64 20 74 6f 77 61 72 64 | 73 20 64 69 73 70 6c 61 |d toward|s displa|
|00000670| 79 69 6e 67 20 75 6e 64 | 65 72 20 58 20 57 69 6e |ying und|er X Win|
|00000680| 64 6f 77 73 2e 20 20 54 | 68 65 0a 76 61 6c 75 65 |dows. T|he.value|
|00000690| 20 6f 66 20 68 61 76 69 | 6e 67 20 61 20 70 6f 72 | of havi|ng a por|
|000006a0| 74 61 62 6c 65 2c 20 73 | 6f 66 74 77 61 72 65 20 |table, s|oftware |
|000006b0| 4d 50 45 47 20 64 65 63 | 6f 64 65 72 20 69 73 20 |MPEG dec|oder is |
|000006c0| 61 6d 70 6c 79 0a 64 65 | 6d 6f 6e 73 74 72 61 74 |amply.de|monstrat|
|000006d0| 65 64 20 62 79 20 74 68 | 65 20 6e 75 6d 62 65 72 |ed by th|e number|
|000006e0| 20 6f 66 20 70 72 6f 67 | 72 61 6d 73 20 74 68 61 | of prog|rams tha|
|000006f0| 74 20 68 61 76 65 20 62 | 65 65 6e 20 61 64 61 70 |t have b|een adap|
|00000700| 74 65 64 20 66 72 6f 6d | 0a 74 68 69 73 20 6f 72 |ted from|.this or|
|00000710| 69 67 69 6e 61 6c 20 42 | 65 72 6b 65 6c 65 79 20 |iginal B|erkeley |
|00000720| 73 6f 75 72 63 65 20 28 | 69 6e 63 6c 75 64 69 6e |source (|includin|
|00000730| 67 20 70 6f 72 74 73 20 | 74 6f 20 74 68 65 20 4c |g ports |to the L|
|00000740| 69 6e 75 78 20 53 56 47 | 41 0a 6c 69 62 72 61 72 |inux SVG|A.librar|
|00000750| 79 2c 20 53 69 6c 69 63 | 6f 6e 20 47 72 61 70 68 |y, Silic|on Graph|
|00000760| 69 63 73 20 68 61 72 64 | 77 61 72 65 2c 20 61 6e |ics hard|ware, an|
|00000770| 64 20 61 20 6e 6f 6e 2d | 64 69 73 70 6c 61 79 20 |d a non-|display |
|00000780| 4d 50 45 47 20 69 6e 66 | 6f 72 6d 61 74 69 6f 6e |MPEG inf|ormation|
|00000790| 0a 75 74 69 6c 69 74 79 | 29 2e 20 20 48 6f 77 65 |.utility|). Howe|
|000007a0| 76 65 72 2c 20 74 68 65 | 20 75 74 69 6c 69 74 79 |ver, the| utility|
|000007b0| 20 6f 66 20 74 68 65 20 | 64 65 63 6f 64 65 72 20 | of the |decoder |
|000007c0| 77 61 73 20 6c 69 6d 69 | 74 65 64 20 62 79 20 74 |was limi|ted by t|
|000007d0| 68 65 0a 64 69 66 66 69 | 63 75 6c 74 79 20 6f 66 |he.diffi|culty of|
|000007e0| 20 65 78 74 72 61 63 74 | 69 6e 67 20 74 68 65 20 | extract|ing the |
|000007f0| 75 73 65 66 75 6c 2c 20 | 4d 50 45 47 2d 72 65 6c |useful, |MPEG-rel|
|00000800| 61 74 65 64 20 73 6f 75 | 72 63 65 20 63 6f 64 65 |ated sou|rce code|
|00000810| 20 66 72 6f 6d 20 74 68 | 65 0a 58 31 31 2d 73 70 | from th|e.X11-sp|
|00000820| 65 63 69 66 69 63 2c 20 | 64 69 73 70 6c 61 79 2d |ecific, |display-|
|00000830| 72 65 6c 61 74 65 64 20 | 73 6f 75 72 63 65 2e 20 |related |source. |
|00000840| 20 45 73 73 65 6e 74 69 | 61 6c 6c 79 20 77 68 61 | Essenti|ally wha|
|00000850| 74 20 77 61 73 20 6e 65 | 65 64 65 64 20 77 61 73 |t was ne|eded was|
|00000860| 0a 61 20 73 69 6d 70 6c | 65 20 69 6e 74 65 72 66 |.a simpl|e interf|
|00000870| 61 63 65 20 74 68 61 74 | 20 77 6f 75 6c 64 20 61 |ace that| would a|
|00000880| 6c 6c 6f 77 20 61 20 70 | 72 6f 67 72 61 6d 6d 65 |llow a p|rogramme|
|00000890| 72 20 74 6f 20 65 78 74 | 72 61 63 74 20 66 72 61 |r to ext|ract fra|
|000008a0| 6d 65 73 0a 66 72 6f 6d | 20 61 6e 20 4d 50 45 47 |mes.from| an MPEG|
|000008b0| 20 73 74 72 65 61 6d 20 | 28 65 69 74 68 65 72 20 | stream |(either |
|000008c0| 62 65 66 6f 72 65 20 6f | 72 20 61 66 74 65 72 20 |before o|r after |
|000008d0| 63 6f 6e 76 65 72 74 69 | 6e 67 20 74 6f 20 52 47 |converti|ng to RG|
|000008e0| 42 20 63 6f 6c 6f 75 72 | 0a 73 70 61 63 65 29 2c |B colour|.space),|
|000008f0| 20 61 6e 64 20 74 68 65 | 6e 20 74 6f 20 64 6f 20 | and the|n to do |
|00000900| 77 69 74 68 20 74 68 65 | 20 69 6d 61 67 65 20 64 |with the| image d|
|00000910| 61 74 61 20 61 73 20 68 | 65 20 6f 72 20 73 68 65 |ata as h|e or she|
|00000920| 20 73 61 77 20 66 69 74 | 2e 0a 0a 54 68 65 20 4d | saw fit|...The M|
|00000930| 50 45 47 20 4c 69 62 72 | 61 72 79 20 69 73 20 69 |PEG Libr|ary is i|
|00000940| 6e 74 65 6e 64 65 64 20 | 74 6f 20 66 69 6c 6c 20 |ntended |to fill |
|00000950| 74 68 69 73 20 6e 65 65 | 64 2e 20 20 49 74 20 77 |this nee|d. It w|
|00000960| 61 73 20 64 65 76 65 6c | 6f 70 65 64 20 61 74 0a |as devel|oped at.|
|00000970| 74 68 65 20 4d 6f 6e 74 | 72 65 61 6c 20 4e 65 75 |the Mont|real Neu|
|00000980| 72 6f 6c 6f 67 69 63 61 | 6c 20 49 6e 73 74 69 74 |rologica|l Instit|
|00000990| 75 74 65 20 69 6e 20 74 | 68 65 20 73 75 6d 6d 65 |ute in t|he summe|
|000009a0| 72 20 6f 66 20 31 39 39 | 34 20 69 6e 20 6f 72 64 |r of 199|4 in ord|
|000009b0| 65 72 20 74 6f 0a 66 61 | 63 69 6c 69 74 61 74 65 |er to.fa|cilitate|
|000009c0| 20 74 68 65 20 64 65 76 | 65 6c 6f 70 6d 65 6e 74 | the dev|elopment|
|000009d0| 20 6f 66 20 61 20 68 69 | 67 68 2d 70 65 72 66 6f | of a hi|gh-perfo|
|000009e0| 72 6d 61 6e 63 65 2c 20 | 66 65 61 74 75 72 65 2d |rmance, |feature-|
|000009f0| 68 65 61 76 79 0a 4d 50 | 45 47 20 70 6c 61 79 65 |heavy.MP|EG playe|
|00000a00| 72 20 66 6f 72 20 53 69 | 6c 69 63 6f 6e 20 47 72 |r for Si|licon Gr|
|00000a10| 61 70 68 69 63 73 20 77 | 6f 72 6b 73 74 61 74 69 |aphics w|orkstati|
|00000a20| 6f 6e 73 2e 20 20 53 69 | 6e 63 65 20 74 68 65 6e |ons. Si|nce then|
|00000a30| 2c 20 74 68 65 0a 4c 69 | 62 72 61 72 79 20 68 61 |, the.Li|brary ha|
|00000a40| 73 20 66 6f 75 6e 64 20 | 61 20 75 73 65 20 69 6e |s found |a use in|
|00000a50| 20 6e 75 6d 65 72 6f 75 | 73 20 61 70 70 6c 69 63 | numerou|s applic|
|00000a60| 61 74 69 6f 6e 73 2c 20 | 6e 6f 74 61 62 6c 79 20 |ations, |notably |
|00000a70| 61 73 20 6f 6e 65 20 6f | 66 0a 73 65 76 65 72 61 |as one o|f.severa|
|00000a80| 6c 20 6f 70 74 69 6f 6e | 61 6c 20 6c 69 62 72 61 |l option|al libra|
|00000a90| 72 69 65 73 20 75 73 65 | 64 20 66 6f 72 20 65 78 |ries use|d for ex|
|00000aa0| 74 65 6e 64 69 6e 67 20 | 74 68 65 20 77 65 6c 6c |tending |the well|
|00000ab0| 2d 6b 6e 6f 77 6e 0a 49 | 6d 61 67 65 4d 61 67 69 |-known.I|mageMagi|
|00000ac0| 63 6b 20 73 75 69 74 65 | 20 6f 66 20 67 72 61 70 |ck suite| of grap|
|00000ad0| 68 69 63 73 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |hics app|lication|
|00000ae0| 73 2e 0a 0a 5c 73 65 63 | 74 69 6f 6e 7b 50 72 6f |s...\sec|tion{Pro|
|00000af0| 67 72 61 6d 6d 69 6e 67 | 20 77 69 74 68 20 74 68 |gramming| with th|
|00000b00| 65 20 4d 50 45 47 20 4c | 69 62 72 61 72 79 7d 0a |e MPEG L|ibrary}.|
|00000b10| 0a 55 73 69 6e 67 20 74 | 68 65 20 4c 69 62 72 61 |.Using t|he Libra|
|00000b20| 72 79 20 69 73 20 71 75 | 69 74 65 20 73 74 72 61 |ry is qu|ite stra|
|00000b30| 69 67 68 74 66 6f 72 77 | 61 72 64 2c 20 61 6e 64 |ightforw|ard, and|
|00000b40| 20 69 73 20 61 6e 61 6c | 6f 67 6f 75 73 20 74 6f | is anal|ogous to|
|00000b50| 20 74 68 65 0a 77 61 79 | 20 69 6e 20 77 68 69 63 | the.way| in whic|
|00000b60| 68 20 66 69 6c 65 73 20 | 68 61 76 65 20 62 65 65 |h files |have bee|
|00000b70| 6e 20 74 72 61 64 69 74 | 69 6f 6e 61 6c 6c 79 20 |n tradit|ionally |
|00000b80| 68 61 6e 64 6c 65 64 3a | 20 79 6f 75 20 6f 70 65 |handled:| you ope|
|00000b90| 6e 20 61 6e 20 4d 50 45 | 47 0a 73 74 72 65 61 6d |n an MPE|G.stream|
|00000ba0| 20 74 6f 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 69 | to init|ialize i|
|00000bb0| 6e 74 65 72 6e 61 6c 20 | 64 61 74 61 20 73 74 72 |nternal |data str|
|00000bc0| 75 63 74 75 72 65 73 2c | 20 61 6e 64 20 74 68 65 |uctures,| and the|
|00000bd0| 6e 20 72 65 61 64 20 66 | 72 61 6d 65 73 0a 75 6e |n read f|rames.un|
|00000be0| 74 69 6c 20 74 68 65 20 | 73 74 72 65 61 6d 20 69 |til the |stream i|
|00000bf0| 73 20 65 78 68 61 75 73 | 74 65 64 2e 20 20 41 74 |s exhaus|ted. At|
|00000c00| 20 61 6e 79 20 70 6f 69 | 6e 74 2c 20 79 6f 75 20 | any poi|nt, you |
|00000c10| 63 61 6e 20 72 65 77 69 | 6e 64 20 74 68 65 0a 73 |can rewi|nd the.s|
|00000c20| 74 72 65 61 6d 20 74 6f | 20 73 74 61 72 74 20 6f |tream to| start o|
|00000c30| 76 65 72 3b 20 68 6f 77 | 65 76 65 72 2c 20 72 61 |ver; how|ever, ra|
|00000c40| 6e 64 6f 6d 20 61 63 63 | 65 73 73 20 69 73 20 6e |ndom acc|ess is n|
|00000c50| 6f 74 20 61 6c 6c 6f 77 | 65 64 2e 20 20 28 54 68 |ot allow|ed. (Th|
|00000c60| 69 73 20 69 73 0a 6e 6f | 74 20 64 75 65 20 74 6f |is is.no|t due to|
|00000c70| 20 61 20 66 75 6e 64 61 | 6d 65 6e 74 61 6c 20 77 | a funda|mental w|
|00000c80| 65 61 6b 6e 65 73 73 20 | 77 69 74 68 20 4d 50 45 |eakness |with MPE|
|00000c90| 47 3b 20 68 6f 77 65 76 | 65 72 2c 20 64 75 65 20 |G; howev|er, due |
|00000ca0| 74 6f 20 74 68 65 0a 6e | 61 74 75 72 65 20 6f 66 |to the.n|ature of|
|00000cb0| 20 74 68 65 20 64 65 63 | 6f 64 69 6e 67 20 65 6e | the dec|oding en|
|00000cc0| 67 69 6e 65 20 61 74 20 | 74 68 65 20 68 65 61 72 |gine at |the hear|
|00000cd0| 74 20 6f 66 20 74 68 65 | 20 4d 50 45 47 20 4c 69 |t of the| MPEG Li|
|00000ce0| 62 72 61 72 79 2c 20 64 | 6f 6e 27 74 0a 65 78 70 |brary, d|on't.exp|
|00000cf0| 65 63 74 20 74 6f 20 73 | 65 65 20 69 74 20 69 6d |ect to s|ee it im|
|00000d00| 70 6c 65 6d 65 6e 74 65 | 64 20 68 65 72 65 20 61 |plemente|d here a|
|00000d10| 6e 79 20 74 69 6d 65 20 | 73 6f 6f 6e 2e 29 20 20 |ny time |soon.) |
|00000d20| 57 68 65 6e 20 79 6f 75 | 20 61 72 65 0a 66 69 6e |When you| are.fin|
|00000d30| 69 73 68 65 64 20 77 69 | 74 68 20 74 68 65 20 73 |ished wi|th the s|
|00000d40| 74 72 65 61 6d 2c 20 79 | 6f 75 20 63 6c 6f 73 65 |tream, y|ou close|
|00000d50| 20 69 74 20 74 6f 20 63 | 6c 65 61 6e 20 75 70 2e | it to c|lean up.|
|00000d60| 0a 0a 48 65 72 65 20 69 | 73 20 61 20 73 69 6d 70 |..Here i|s a simp|
|00000d70| 6c 65 20 65 78 61 6d 70 | 6c 65 20 70 72 6f 67 72 |le examp|le progr|
|00000d80| 61 6d 20 74 6f 20 6f 70 | 65 6e 20 61 6e 20 4d 50 |am to op|en an MP|
|00000d90| 45 47 20 73 74 72 65 61 | 6d 20 28 6e 61 6d 65 64 |EG strea|m (named|
|00000da0| 20 62 79 20 74 68 65 0a | 66 69 72 73 74 20 63 6f | by the.|first co|
|00000db0| 6d 6d 61 6e 64 2d 6c 69 | 6e 65 20 61 72 67 75 6d |mmand-li|ne argum|
|00000dc0| 65 6e 74 29 20 61 6e 64 | 20 72 65 61 64 20 61 6c |ent) and| read al|
|00000dd0| 6c 20 66 72 61 6d 65 73 | 20 66 72 6f 6d 20 69 74 |l frames| from it|
|00000de0| 2e 20 20 53 69 6e 63 65 | 0a 64 69 73 70 6c 61 79 |. Since|.display|
|00000df0| 69 6e 67 20 69 6d 61 67 | 65 73 20 69 73 20 61 73 |ing imag|es is as|
|00000e00| 20 6e 6f 6e 2d 70 6f 72 | 74 61 62 6c 65 20 61 73 | non-por|table as|
|00000e10| 20 69 74 20 69 73 20 64 | 65 73 69 72 61 62 6c 65 | it is d|esirable|
|00000e20| 2c 20 49 20 68 61 76 65 | 0a 69 6e 63 6c 75 64 65 |, I have|.include|
|00000e30| 64 20 63 61 6c 6c 73 20 | 74 6f 20 64 75 6d 6d 79 |d calls |to dummy|
|00000e40| 20 72 6f 75 74 69 6e 65 | 73 20 5c 63 6f 64 65 7b | routine|s \code{|
|00000e50| 49 6e 69 74 69 61 6c 69 | 7a 65 44 69 73 70 6c 61 |Initiali|zeDispla|
|00000e60| 79 28 29 7d 20 61 6e 64 | 0a 5c 63 6f 64 65 7b 53 |y()} and|.\code{S|
|00000e70| 68 6f 77 46 72 61 6d 65 | 28 29 7d 3b 20 61 63 74 |howFrame|()}; act|
|00000e80| 75 61 6c 6c 79 20 64 65 | 66 69 6e 69 6e 67 20 74 |ually de|fining t|
|00000e90| 68 65 73 65 20 69 73 20 | 75 70 20 74 6f 20 79 6f |hese is |up to yo|
|00000ea0| 75 2e 20 20 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |u. .\be|gin{verb|
|00000eb0| 61 74 69 6d 7d 0a 23 69 | 6e 63 6c 75 64 65 20 3c |atim}.#i|nclude <|
|00000ec0| 73 74 64 69 6f 2e 68 3e | 0a 23 69 6e 63 6c 75 64 |stdio.h>|.#includ|
|00000ed0| 65 20 22 6d 70 65 67 2e | 68 22 0a 0a 69 6e 74 20 |e "mpeg.|h"..int |
|00000ee0| 6d 61 69 6e 20 28 69 6e | 74 20 61 72 67 63 2c 20 |main (in|t argc, |
|00000ef0| 63 68 61 72 20 2a 61 72 | 67 76 5b 5d 29 0a 7b 0a |char *ar|gv[]).{.|
|00000f00| 20 20 20 46 49 4c 45 20 | 20 20 20 20 20 20 2a 6d | FILE | *m|
|00000f10| 70 65 67 3b 0a 20 20 20 | 49 6d 61 67 65 44 65 73 |peg;. |ImageDes|
|00000f20| 63 20 20 20 69 6d 67 3b | 0a 20 20 20 42 6f 6f 6c |c img;|. Bool|
|00000f30| 65 61 6e 20 20 20 20 20 | 6d 6f 72 65 66 72 61 6d |ean |morefram|
|00000f40| 65 73 20 3d 20 54 52 55 | 45 3b 0a 20 20 20 63 68 |es = TRU|E;. ch|
|00000f50| 61 72 20 20 20 20 20 20 | 20 2a 70 69 78 65 6c 73 |ar | *pixels|
|00000f60| 3b 0a 0a 20 20 20 6d 70 | 65 67 20 3d 20 66 6f 70 |;.. mp|eg = fop|
|00000f70| 65 6e 20 28 61 72 67 76 | 5b 31 5d 2c 20 22 72 22 |en (argv|[1], "r"|
|00000f80| 29 3b 0a 20 20 20 53 65 | 74 4d 50 45 47 4f 70 74 |);. Se|tMPEGOpt|
|00000f90| 69 6f 6e 20 28 4d 50 45 | 47 5f 44 49 54 48 45 52 |ion (MPE|G_DITHER|
|00000fa0| 2c 20 46 55 4c 4c 5f 43 | 4f 4c 4f 52 5f 44 49 54 |, FULL_C|OLOR_DIT|
|00000fb0| 48 45 52 29 3b 0a 20 20 | 20 4f 70 65 6e 4d 50 45 |HER);. | OpenMPE|
|00000fc0| 47 20 28 6d 70 65 67 2c | 20 26 69 6d 67 29 3b 0a |G (mpeg,| &img);.|
|00000fd0| 0a 20 20 20 49 6e 69 74 | 69 61 6c 69 7a 65 44 69 |. Init|ializeDi|
|00000fe0| 73 70 6c 61 79 20 28 69 | 6d 67 2e 57 69 64 74 68 |splay (i|mg.Width|
|00000ff0| 2c 20 69 6d 67 2e 48 65 | 69 67 68 74 29 3b 0a 20 |, img.He|ight);. |
|00001000| 20 20 70 69 78 65 6c 73 | 20 3d 20 28 63 68 61 72 | pixels| = (char|
|00001010| 20 2a 29 20 6d 61 6c 6c | 6f 63 20 28 69 6d 67 2e | *) mall|oc (img.|
|00001020| 53 69 7a 65 29 3b 0a 20 | 20 20 77 68 69 6c 65 20 |Size);. | while |
|00001030| 28 6d 6f 72 65 66 72 61 | 6d 65 73 29 0a 20 20 20 |(morefra|mes). |
|00001040| 7b 0a 20 20 20 20 20 20 | 6d 6f 72 65 66 72 61 6d |{. |morefram|
|00001050| 65 73 20 3d 20 47 65 74 | 4d 50 45 47 46 72 61 6d |es = Get|MPEGFram|
|00001060| 65 20 28 70 69 78 65 6c | 73 29 3b 0a 20 20 20 20 |e (pixel|s);. |
|00001070| 20 20 44 69 73 70 6c 61 | 79 46 72 61 6d 65 20 28 | Displa|yFrame (|
|00001080| 69 6d 67 2e 57 69 64 74 | 68 2c 20 69 6d 67 2e 48 |img.Widt|h, img.H|
|00001090| 65 69 67 68 74 2c 20 70 | 69 78 65 6c 73 29 0a 20 |eight, p|ixels). |
|000010a0| 20 20 7d 0a 20 20 20 43 | 6c 6f 73 65 4d 50 45 47 | }. C|loseMPEG|
|000010b0| 20 28 29 3b 0a 20 20 20 | 66 63 6c 6f 73 65 20 28 | ();. |fclose (|
|000010c0| 6d 70 65 67 29 3b 0a 7d | 0a 5c 65 6e 64 7b 76 65 |mpeg);.}|.\end{ve|
|000010d0| 72 62 61 74 69 6d 7d 0a | 0a 46 6f 72 20 61 20 63 |rbatim}.|.For a c|
|000010e0| 6f 6e 63 72 65 74 65 20 | 65 78 61 6d 70 6c 65 2c |oncrete |example,|
|000010f0| 20 79 6f 75 20 6d 69 67 | 68 74 20 77 69 73 68 20 | you mig|ht wish |
|00001100| 74 6f 20 63 6f 6e 73 75 | 6c 74 20 5c 63 6f 64 65 |to consu|lt \code|
|00001110| 7b 65 61 73 79 6d 70 65 | 67 2e 63 7d 2c 20 61 0a |{easympe|g.c}, a.|
|00001120| 76 65 72 79 20 73 69 6d | 70 6c 65 20 53 47 49 2d |very sim|ple SGI-|
|00001130| 73 70 65 63 69 66 69 63 | 20 4d 50 45 47 20 70 6c |specific| MPEG pl|
|00001140| 61 79 65 72 20 69 6e 63 | 6c 75 64 65 64 20 77 69 |ayer inc|luded wi|
|00001150| 74 68 20 74 68 65 20 4c | 69 62 72 61 72 79 2e 20 |th the L|ibrary. |
|00001160| 20 41 6c 73 6f 2c 0a 49 | 20 68 61 76 65 20 6f 6d | Also,.I| have om|
|00001170| 69 74 74 65 64 20 61 6e | 79 20 65 72 72 6f 72 2d |itted an|y error-|
|00001180| 63 68 65 63 6b 69 6e 67 | 20 6f 72 20 68 61 6e 64 |checking| or hand|
|00001190| 6c 69 6e 67 20 68 65 72 | 65 3b 20 61 67 61 69 6e |ling her|e; again|
|000011a0| 2c 20 63 6f 6e 73 75 6c | 74 0a 5c 63 6f 64 65 7b |, consul|t.\code{|
|000011b0| 65 61 73 79 6d 70 65 67 | 2e 63 7d 20 66 6f 72 20 |easympeg|.c} for |
|000011c0| 61 20 6d 6f 72 65 20 72 | 65 61 6c 69 73 74 69 63 |a more r|ealistic|
|000011d0| 20 65 78 61 6d 70 6c 65 | 2e 5c 66 6f 6f 74 6e 6f | example|.\footno|
|000011e0| 74 65 7b 46 6f 72 20 61 | 6e 20 65 76 65 6e 0a 6d |te{For a|n even.m|
|000011f0| 6f 72 65 20 72 65 61 6c | 69 73 74 69 63 20 28 62 |ore real|istic (b|
|00001200| 75 74 20 6f 66 20 63 6f | 75 72 73 65 20 63 6f 6e |ut of co|urse con|
|00001210| 73 69 64 65 72 61 62 6c | 79 20 6c 61 72 67 65 72 |siderabl|y larger|
|00001220| 29 20 65 78 61 6d 70 6c | 65 2c 20 74 61 6b 65 20 |) exampl|e, take |
|00001230| 61 0a 6c 6f 6f 6b 20 61 | 74 20 5c 63 6f 64 65 7b |a.look a|t \code{|
|00001240| 67 6c 6d 70 65 67 5c 5f | 70 6c 61 79 7d 2e 20 20 |glmpeg\_|play}. |
|00001250| 54 68 69 73 20 69 73 20 | 74 68 65 20 66 75 6c 6c |This is |the full|
|00001260| 2d 66 65 61 74 75 72 65 | 64 20 4d 50 45 47 20 70 |-feature|d MPEG p|
|00001270| 6c 61 79 65 72 0a 74 68 | 61 74 20 77 61 73 20 74 |layer.th|at was t|
|00001280| 68 65 20 69 6d 70 65 74 | 75 73 20 66 6f 72 20 63 |he impet|us for c|
|00001290| 72 65 61 74 69 6e 67 20 | 74 68 65 20 4d 50 45 47 |reating |the MPEG|
|000012a0| 20 4c 69 62 72 61 72 79 | 3b 20 69 74 20 69 73 20 | Library|; it is |
|000012b0| 61 76 61 69 6c 61 62 6c | 65 20 62 79 0a 61 6e 6f |availabl|e by.ano|
|000012c0| 6e 79 6d 6f 75 73 20 66 | 74 70 20 66 72 6f 6d 20 |nymous f|tp from |
|000012d0| 5c 63 6f 64 65 7b 66 74 | 70 2e 6d 6e 69 2e 6d 63 |\code{ft|p.mni.mc|
|000012e0| 67 69 6c 6c 2e 63 61 7d | 2c 20 69 6e 20 5c 63 6f |gill.ca}|, in \co|
|000012f0| 64 65 7b 2f 70 75 62 2f | 6d 70 65 67 7d 2e 7d 0a |de{/pub/|mpeg}.}.|
|00001300| 0a 4e 6f 74 65 20 69 6e | 20 70 61 72 74 69 63 75 |.Note in| particu|
|00001310| 6c 61 72 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |lar the |followin|
|00001320| 67 20 70 6f 69 6e 74 73 | 20 61 62 6f 75 74 20 74 |g points| about t|
|00001330| 68 65 20 61 62 6f 76 65 | 20 63 6f 64 65 3a 0a 5c |he above| code:.\|
|00001340| 62 65 67 69 6e 7b 69 74 | 65 6d 69 7a 65 7d 0a 5c |begin{it|emize}.\|
|00001350| 69 74 65 6d 20 54 68 65 | 20 63 61 6c 6c 65 72 20 |item The| caller |
|00001360| 6d 75 73 74 20 74 61 6b | 65 20 63 61 72 65 20 6f |must tak|e care o|
|00001370| 66 20 6f 70 65 6e 69 6e | 67 20 61 6e 64 20 63 6c |f openin|g and cl|
|00001380| 6f 73 69 6e 67 20 74 68 | 65 20 66 69 6c 65 0a 63 |osing th|e file.c|
|00001390| 6f 6e 74 61 69 6e 69 6e | 67 20 74 68 65 20 4d 50 |ontainin|g the MP|
|000013a0| 45 47 20 73 74 72 65 61 | 6d 3b 20 74 68 65 20 4c |EG strea|m; the L|
|000013b0| 69 62 72 61 72 79 20 61 | 73 73 75 6d 65 73 20 74 |ibrary a|ssumes t|
|000013c0| 68 61 74 20 69 74 20 69 | 73 20 70 61 73 73 65 64 |hat it i|s passed|
|000013d0| 20 61 0a 66 69 6c 65 20 | 72 65 61 64 79 20 66 6f | a.file |ready fo|
|000013e0| 72 20 72 65 61 64 69 6e | 67 2e 0a 5c 69 74 65 6d |r readin|g..\item|
|000013f0| 20 54 68 65 20 5c 63 6f | 64 65 7b 49 6d 61 67 65 | The \co|de{Image|
|00001400| 44 65 73 63 7d 20 73 74 | 72 75 63 74 75 72 65 20 |Desc} st|ructure |
|00001410| 63 6f 6e 74 61 69 6e 73 | 20 61 6c 6c 20 74 68 65 |contains| all the|
|00001420| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 74 68 61 | informa|tion tha|
|00001430| 74 0a 73 68 6f 75 6c 64 | 20 62 65 20 6e 65 65 64 |t.should| be need|
|00001440| 65 64 20 74 6f 20 64 69 | 73 70 6c 61 79 20 66 72 |ed to di|splay fr|
|00001450| 61 6d 65 73 20 66 72 6f | 6d 20 74 68 65 20 4d 50 |ames fro|m the MP|
|00001460| 45 47 20 73 74 72 65 61 | 6d 20 28 61 6c 74 68 6f |EG strea|m (altho|
|00001470| 75 67 68 20 6e 6f 74 0a | 6e 65 63 65 73 73 61 72 |ugh not.|necessar|
|00001480| 69 6c 79 20 61 6c 6c 20 | 74 68 65 20 69 6e 66 6f |ily all |the info|
|00001490| 72 6d 61 74 69 6f 6e 20 | 79 6f 75 20 63 6f 75 6c |rmation |you coul|
|000014a0| 64 20 70 6f 73 73 69 62 | 6c 79 20 77 61 6e 74 20 |d possib|ly want |
|000014b0| 74 6f 20 6b 6e 6f 77 20 | 61 62 6f 75 74 0a 61 6e |to know |about.an|
|000014c0| 20 4d 50 45 47 20 73 74 | 72 65 61 6d 29 2e 20 20 | MPEG st|ream). |
|000014d0| 0a 25 49 6e 20 70 61 72 | 74 69 63 75 6c 61 72 2c |.%In par|ticular,|
|000014e0| 20 74 68 65 20 66 69 65 | 6c 64 73 20 5c 63 6f 64 | the fie|lds \cod|
|000014f0| 65 7b 48 65 69 67 68 74 | 7d 20 61 6e 64 0a 25 5c |e{Height|} and.%\|
|00001500| 63 6f 64 65 7b 57 69 64 | 74 68 7d 20 61 72 65 20 |code{Wid|th} are |
|00001510| 74 68 65 20 68 65 69 67 | 68 74 20 61 6e 64 20 77 |the heig|ht and w|
|00001520| 69 64 74 68 20 6f 66 20 | 65 61 63 68 20 66 72 61 |idth of |each fra|
|00001530| 6d 65 20 69 6e 20 70 69 | 78 65 6c 73 3b 0a 25 5c |me in pi|xels;.%\|
|00001540| 63 6f 64 65 7b 44 65 70 | 74 68 7d 20 69 73 20 74 |code{Dep|th} is t|
|00001550| 68 65 20 64 65 70 74 68 | 20 28 69 6e 20 62 69 74 |he depth| (in bit|
|00001560| 73 29 20 6f 66 20 65 61 | 63 68 20 70 69 78 65 6c |s) of ea|ch pixel|
|00001570| 3b 20 5c 63 6f 64 65 7b | 50 69 78 65 6c 53 69 7a |; \code{|PixelSiz|
|00001580| 65 7d 20 69 73 0a 25 74 | 68 65 20 61 63 74 75 61 |e} is.%t|he actua|
|00001590| 6c 20 6e 75 6d 62 65 72 | 20 6f 66 20 62 69 74 73 |l number| of bits|
|000015a0| 20 73 74 6f 72 65 64 20 | 70 65 72 20 70 69 78 65 | stored |per pixe|
|000015b0| 6c 3b 20 5c 63 6f 64 65 | 7b 53 69 7a 65 7d 20 69 |l; \code|{Size} i|
|000015c0| 73 20 74 68 65 20 73 69 | 7a 65 20 69 6e 0a 25 62 |s the si|ze in.%b|
|000015d0| 79 74 65 73 20 6f 66 20 | 65 61 63 68 20 65 6e 74 |ytes of |each ent|
|000015e0| 69 72 65 20 64 65 63 6f | 64 65 64 20 61 6e 64 20 |ire deco|ded and |
|000015f0| 75 6e 63 6f 6d 70 72 65 | 73 73 65 64 20 66 72 61 |uncompre|ssed fra|
|00001600| 6d 65 3b 20 61 6e 64 0a | 25 5c 63 6f 64 65 7b 42 |me; and.|%\code{B|
|00001610| 69 74 6d 61 70 50 61 64 | 7d 20 67 69 76 65 73 20 |itmapPad|} gives |
|00001620| 74 68 65 20 60 60 71 75 | 61 6e 74 75 6d 27 27 20 |the ``qu|antum'' |
|00001630| 6f 66 20 61 20 73 63 61 | 6e 20 6c 69 6e 65 2e 20 |of a sca|n line. |
|00001640| 20 28 45 61 63 68 20 73 | 63 61 6e 0a 25 6c 69 6e | (Each s|can.%lin|
|00001650| 65 20 73 74 61 72 74 73 | 20 6f 6e 20 61 6e 20 65 |e starts| on an e|
|00001660| 76 65 6e 20 6d 75 6c 74 | 69 70 6c 65 20 6f 66 20 |ven mult|iple of |
|00001670| 74 68 69 73 20 6d 61 6e | 79 20 62 69 74 73 2e 29 |this man|y bits.)|
|00001680| 0a 5c 69 74 65 6d 20 5c | 63 6f 64 65 7b 53 65 74 |.\item \|code{Set|
|00001690| 4d 50 45 47 4f 70 74 69 | 6f 6e 28 29 7d 20 63 61 |MPEGOpti|on()} ca|
|000016a0| 6e 20 62 65 20 75 73 65 | 64 20 74 6f 20 63 6f 6e |n be use|d to con|
|000016b0| 74 72 6f 6c 20 73 6f 6d | 65 77 68 61 74 20 74 68 |trol som|ewhat th|
|000016c0| 65 0a 64 65 63 6f 64 69 | 6e 67 20 6f 66 20 66 72 |e.decodi|ng of fr|
|000016d0| 61 6d 65 73 2e 20 20 49 | 6e 20 61 64 64 69 74 69 |ames. I|n additi|
|000016e0| 6f 6e 20 74 6f 20 73 65 | 6c 65 63 74 69 6e 67 20 |on to se|lecting |
|000016f0| 61 20 64 69 74 68 65 72 | 69 6e 67 20 6d 6f 64 65 |a dither|ing mode|
|00001700| 2c 20 79 6f 75 0a 63 61 | 6e 20 61 6c 73 6f 20 73 |, you.ca|n also s|
|00001710| 65 6c 65 63 74 20 74 68 | 65 20 6c 75 6d 69 6e 61 |elect th|e lumina|
|00001720| 6e 63 65 20 61 6e 64 20 | 63 68 72 6f 6d 69 6e 61 |nce and |chromina|
|00001730| 6e 63 65 20 72 61 6e 67 | 65 73 20 75 73 65 64 20 |nce rang|es used |
|00001740| 66 6f 72 0a 64 69 74 68 | 65 72 69 6e 67 2e 20 20 |for.dith|ering. |
|00001750| 41 6c 73 6f 2c 20 6e 6f | 74 65 20 74 68 61 74 20 |Also, no|te that |
|00001760| 5c 63 6f 64 65 7b 53 65 | 74 4d 50 45 47 4f 70 74 |\code{Se|tMPEGOpt|
|00001770| 69 6f 6e 28 29 7d 20 73 | 68 6f 75 6c 64 20 62 65 |ion()} s|hould be|
|00001780| 20 63 61 6c 6c 65 64 0a | 7b 5c 65 6d 20 62 65 66 | called.|{\em bef|
|00001790| 6f 72 65 7d 20 5c 63 6f | 64 65 7b 4f 70 65 6e 4d |ore} \co|de{OpenM|
|000017a0| 50 45 47 28 29 7d 20 77 | 68 65 6e 20 73 65 74 74 |PEG()} w|hen sett|
|000017b0| 69 6e 67 20 74 68 65 20 | 64 69 74 68 65 72 69 6e |ing the |ditherin|
|000017c0| 67 20 6d 65 74 68 6f 64 | 2e 0a 5c 69 74 65 6d 20 |g method|..\item |
|000017d0| 54 68 65 20 4d 50 45 47 | 20 64 61 74 61 20 63 61 |The MPEG| data ca|
|000017e0| 6e 20 62 65 20 64 65 63 | 6f 64 65 64 20 75 73 69 |n be dec|oded usi|
|000017f0| 6e 67 20 61 20 76 61 72 | 69 65 74 79 20 6f 66 20 |ng a var|iety of |
|00001800| 64 69 74 68 65 72 69 6e | 67 0a 6d 65 74 68 6f 64 |ditherin|g.method|
|00001810| 73 2e 20 20 28 4e 6f 74 | 65 20 74 68 61 74 20 69 |s. (Not|e that i|
|00001820| 6e 20 74 68 69 73 20 63 | 6f 6e 74 65 78 74 2c 20 |n this c|ontext, |
|00001830| 7b 5c 65 6d 20 64 69 74 | 68 65 72 69 6e 67 5c 2f |{\em dit|hering\/|
|00001840| 7d 20 72 65 66 65 72 73 | 20 74 6f 20 63 6f 6e 76 |} refers| to conv|
|00001850| 65 72 74 69 6e 67 0a 66 | 72 6f 6d 20 74 68 65 20 |erting.f|rom the |
|00001860| 6c 75 6d 69 6e 61 6e 63 | 65 2d 63 68 72 6f 6d 61 |luminanc|e-chroma|
|00001870| 74 69 63 69 74 79 2c 20 | 6f 72 20 59 43 72 43 62 |ticity, |or YCrCb|
|00001880| 2c 20 63 6f 6c 6f 75 72 | 20 73 70 61 63 65 20 69 |, colour| space i|
|00001890| 6e 20 77 68 69 63 68 20 | 4d 50 45 47 0a 64 61 74 |n which |MPEG.dat|
|000018a0| 61 20 69 73 20 65 6e 63 | 6f 64 65 64 2c 20 74 6f |a is enc|oded, to|
|000018b0| 20 74 68 65 20 6d 6f 72 | 65 20 63 6f 6e 76 65 6e | the mor|e conven|
|000018c0| 74 69 6f 6e 61 6c 20 52 | 47 42 20 73 63 68 65 6d |tional R|GB schem|
|000018d0| 65 2e 29 0a 5c 69 74 65 | 6d 20 59 6f 75 20 64 6f |e.).\ite|m You do|
|000018e0| 6e 27 74 20 6e 65 65 64 | 20 74 6f 20 70 61 73 73 |n't need| to pass|
|000018f0| 20 61 6e 79 20 70 61 72 | 61 6d 65 74 65 72 73 20 | any par|ameters |
|00001900| 74 6f 20 5c 63 6f 64 65 | 7b 47 65 74 4d 50 45 47 |to \code|{GetMPEG|
|00001910| 46 72 61 6d 65 28 29 7d | 0a 20 20 6f 72 20 5c 63 |Frame()}|. or \c|
|00001920| 6f 64 65 7b 43 6c 6f 73 | 65 4d 50 45 47 28 29 7d |ode{Clos|eMPEG()}|
|00001930| 20 74 6f 20 74 65 6c 6c | 20 69 74 20 77 68 69 63 | to tell| it whic|
|00001940| 68 20 4d 50 45 47 20 73 | 74 72 65 61 6d 20 79 6f |h MPEG s|tream yo|
|00001950| 75 20 6d 65 61 6e 3b 20 | 74 68 69 73 20 69 73 0a |u mean; |this is.|
|00001960| 20 20 62 65 63 61 75 73 | 65 20 74 68 65 20 42 65 | becaus|e the Be|
|00001970| 72 6b 65 6c 65 79 20 64 | 65 63 6f 64 69 6e 67 20 |rkeley d|ecoding |
|00001980| 65 6e 67 69 6e 65 20 28 | 61 6e 64 20 68 65 6e 63 |engine (|and henc|
|00001990| 65 20 74 68 65 20 4d 50 | 45 47 20 4c 69 62 72 61 |e the MP|EG Libra|
|000019a0| 72 79 0a 20 20 69 74 73 | 65 6c 66 29 20 64 65 70 |ry. its|elf) dep|
|000019b0| 65 6e 64 73 20 68 65 61 | 76 69 6c 79 20 6f 6e 20 |ends hea|vily on |
|000019c0| 67 6c 6f 62 61 6c 20 76 | 61 72 69 61 62 6c 65 73 |global v|ariables|
|000019d0| 2c 20 61 6e 64 20 75 6e | 66 6f 72 74 75 6e 61 74 |, and un|fortunat|
|000019e0| 65 6c 79 0a 20 20 63 61 | 6e 6e 6f 74 20 64 65 63 |ely. ca|nnot dec|
|000019f0| 6f 64 65 20 6d 6f 72 65 | 20 74 68 61 6e 20 6f 6e |ode more| than on|
|00001a00| 65 20 4d 50 45 47 20 61 | 74 20 61 20 74 69 6d 65 |e MPEG a|t a time|
|00001a10| 2e 0a 5c 65 6e 64 7b 69 | 74 65 6d 69 7a 65 7d 0a |..\end{i|temize}.|
|00001a20| 25 4d 6f 73 74 20 6f 66 | 20 74 68 65 73 65 0a 25 |%Most of| these.%|
|00001a30| 69 6e 76 6f 6c 76 65 20 | 62 6f 74 68 20 70 69 78 |involve |both pix|
|00001a40| 65 6c 20 76 61 6c 75 65 | 73 20 28 77 68 69 63 68 |el value|s (which|
|00001a50| 20 61 72 65 20 66 69 6c | 6c 65 64 20 69 6e 20 62 | are fil|led in b|
|00001a60| 79 20 63 61 6c 6c 73 20 | 74 6f 0a 25 5c 63 6f 64 |y calls |to.%\cod|
|00001a70| 65 7b 47 65 74 4d 50 45 | 47 46 72 61 6d 65 28 29 |e{GetMPE|GFrame()|
|00001a80| 7d 20 61 6e 64 20 61 20 | 63 6f 6c 6f 75 72 20 6d |} and a |colour m|
|00001a90| 61 70 20 77 68 69 63 68 | 20 6d 61 70 73 20 70 69 |ap which| maps pi|
|00001aa0| 78 65 6c 20 76 61 6c 75 | 65 73 20 74 6f 20 52 47 |xel valu|es to RG|
|00001ab0| 42 0a 25 76 61 6c 75 65 | 73 2e 20 20 54 68 65 20 |B.%value|s. The |
|00001ac0| 73 63 68 65 6d 65 20 75 | 73 65 64 20 68 65 72 65 |scheme u|sed here|
|00001ad0| 2c 20 77 68 69 63 68 20 | 69 73 20 74 68 65 20 64 |, which |is the d|
|00001ae0| 65 66 61 75 6c 74 2c 20 | 75 73 65 73 0a 25 5c 63 |efault, |uses.%\c|
|00001af0| 6f 64 65 7b 46 55 4c 4c | 5c 5f 43 4f 4c 4f 52 5c |ode{FULL|\_COLOR\|
|00001b00| 5f 44 49 54 48 45 52 7d | 20 74 6f 20 72 65 74 75 |_DITHER}| to retu|
|00001b10| 72 6e 20 70 69 78 65 6c | 73 20 61 73 20 52 47 42 |rn pixel|s as RGB|
|00001b20| 20 74 72 69 70 6c 65 73 | 3b 20 6e 6f 20 63 6f 6c | triples|; no col|
|00001b30| 6f 75 72 0a 25 6d 61 70 | 20 69 73 20 69 6e 76 6f |our.%map| is invo|
|00001b40| 6c 76 65 64 2e 20 20 54 | 68 65 20 6f 74 68 65 72 |lved. T|he other|
|00001b50| 20 75 73 65 66 75 6c 20 | 64 69 74 68 65 72 69 6e | useful |ditherin|
|00001b60| 67 20 6d 6f 64 65 73 20 | 61 72 65 0a 25 5c 63 6f |g modes |are.%\co|
|00001b70| 64 65 7b 4f 52 44 45 52 | 45 44 5c 5f 44 49 54 48 |de{ORDER|ED\_DITH|
|00001b80| 45 52 7d 20 61 6e 64 20 | 5c 63 6f 64 65 7b 47 52 |ER} and |\code{GR|
|00001b90| 41 59 5c 5f 44 49 54 48 | 45 52 7d 2c 20 62 6f 74 |AY\_DITH|ER}, bot|
|00001ba0| 68 20 6f 66 20 77 68 69 | 63 68 20 6f 66 66 65 72 |h of whi|ch offer|
|00001bb0| 0a 25 62 65 74 74 65 72 | 20 70 65 72 66 6f 72 6d |.%better| perform|
|00001bc0| 61 6e 63 65 20 61 6e 64 | 20 63 6f 6e 73 75 6d 65 |ance and| consume|
|00001bd0| 20 6c 65 73 73 20 6d 65 | 6d 6f 72 79 20 61 74 20 | less me|mory at |
|00001be0| 74 68 65 20 65 78 70 65 | 6e 73 65 20 6f 66 20 69 |the expe|nse of i|
|00001bf0| 6d 61 67 65 0a 25 71 75 | 61 6c 69 74 79 2e 0a 0a |mage.%qu|ality...|
|00001c00| 4d 6f 72 65 20 64 65 74 | 61 69 6c 65 64 20 69 6e |More det|ailed in|
|00001c10| 66 6f 72 6d 61 74 69 6f | 6e 20 69 73 20 70 72 6f |formatio|n is pro|
|00001c20| 76 69 64 65 64 20 69 6e | 20 73 65 63 74 69 6f 6e |vided in| section|
|00001c30| 73 20 62 65 6c 6f 77 2e | 0a 0a 5c 73 65 63 74 69 |s below.|..\secti|
|00001c40| 6f 6e 7b 43 6f 6e 63 65 | 70 74 73 20 61 6e 64 20 |on{Conce|pts and |
|00001c50| 44 61 74 61 20 46 6f 72 | 6d 61 74 73 7d 0a 0a 54 |Data For|mats}..T|
|00001c60| 68 69 73 20 73 65 63 74 | 69 6f 6e 20 64 65 61 6c |his sect|ion deal|
|00001c70| 73 20 77 69 74 68 20 74 | 68 65 20 6d 61 69 6e 20 |s with t|he main |
|00001c80| 63 6f 6e 63 65 70 74 73 | 20 6e 65 65 64 65 64 20 |concepts| needed |
|00001c90| 74 6f 20 63 6f 6e 74 72 | 6f 6c 20 74 68 65 20 4d |to contr|ol the M|
|00001ca0| 50 45 47 0a 4c 69 62 72 | 61 72 79 20 61 6e 64 20 |PEG.Libr|ary and |
|00001cb0| 74 6f 20 64 69 73 70 6c | 61 79 20 74 68 65 20 64 |to displ|ay the d|
|00001cc0| 61 74 61 20 69 74 20 72 | 65 74 75 72 6e 73 2e 20 |ata it r|eturns. |
|00001cd0| 20 49 74 20 64 6f 65 73 | 20 7b 5c 65 6d 20 6e 6f | It does| {\em no|
|00001ce0| 74 5c 2f 7d 20 64 65 61 | 6c 0a 77 69 74 68 20 74 |t\/} dea|l.with t|
|00001cf0| 68 65 20 64 65 74 61 69 | 6c 73 20 6f 66 20 68 6f |he detai|ls of ho|
|00001d00| 77 20 4d 50 45 47 20 73 | 74 72 65 61 6d 73 20 61 |w MPEG s|treams a|
|00001d10| 72 65 20 65 6e 63 6f 64 | 65 64 2c 20 73 74 6f 72 |re encod|ed, stor|
|00001d20| 65 64 2c 20 6f 72 20 64 | 65 63 6f 64 65 64 2e 0a |ed, or d|ecoded..|
|00001d30| 0a 5c 73 75 62 73 65 63 | 74 69 6f 6e 7b 44 69 74 |.\subsec|tion{Dit|
|00001d40| 68 65 72 69 6e 67 20 6d | 6f 64 65 73 7d 0a 5c 6c |hering m|odes}.\l|
|00001d50| 61 62 65 6c 7b 73 65 63 | 3a 64 69 74 68 65 72 69 |abel{sec|:ditheri|
|00001d60| 6e 67 7d 0a 0a 41 20 6c | 61 72 67 65 20 6e 75 6d |ng}..A l|arge num|
|00001d70| 62 65 72 20 6f 66 20 64 | 69 74 68 65 72 69 6e 67 |ber of d|ithering|
|00001d80| 20 6d 6f 64 65 73 20 28 | 69 6e 20 66 61 63 74 2c | modes (|in fact,|
|00001d90| 20 61 6c 6c 20 74 68 65 | 20 6d 6f 64 65 73 20 70 | all the| modes p|
|00001da0| 72 6f 76 69 64 65 64 20 | 62 79 0a 74 68 65 20 6f |rovided |by.the o|
|00001db0| 72 69 67 69 6e 61 6c 20 | 5c 63 6f 64 65 7b 6d 70 |riginal |\code{mp|
|00001dc0| 65 67 5c 5f 70 6c 61 79 | 7d 29 20 61 72 65 20 61 |eg\_play|}) are a|
|00001dd0| 76 61 69 6c 61 62 6c 65 | 2e 20 20 41 20 66 65 77 |vailable|. A few|
|00001de0| 20 70 72 6f 64 75 63 65 | 0a 6e 6f 6e 73 65 6e 73 | produce|.nonsens|
|00001df0| 69 63 61 6c 20 72 65 73 | 75 6c 74 73 2c 20 62 75 |ical res|ults, bu|
|00001e00| 74 20 61 6c 6c 20 68 61 | 76 65 20 62 65 65 6e 20 |t all ha|ve been |
|00001e10| 66 75 6c 6c 79 20 74 65 | 73 74 65 64 20 69 6e 20 |fully te|sted in |
|00001e20| 74 68 65 20 63 6f 6e 74 | 65 78 74 20 6f 66 0a 74 |the cont|ext of.t|
|00001e30| 68 65 20 4d 50 45 47 20 | 4c 69 62 72 61 72 79 20 |he MPEG |Library |
|00001e40| 61 6e 64 20 66 6f 75 6e | 64 20 74 6f 20 61 67 72 |and foun|d to agr|
|00001e50| 65 65 20 77 69 74 68 20 | 74 68 65 20 72 65 73 75 |ee with |the resu|
|00001e60| 6c 74 73 20 67 69 76 65 | 6e 20 62 79 0a 5c 63 6f |lts give|n by.\co|
|00001e70| 64 65 7b 6d 70 65 67 5c | 5f 70 6c 61 79 7d 2e 0a |de{mpeg\|_play}..|
|00001e80| 0a 60 60 44 69 74 68 65 | 72 69 6e 67 27 27 20 69 |.``Dithe|ring'' i|
|00001e90| 6e 20 74 68 69 73 20 63 | 6f 6e 74 65 78 74 20 69 |n this c|ontext i|
|00001ea0| 73 20 74 68 65 20 63 6f | 6e 76 65 72 73 69 6f 6e |s the co|nversion|
|00001eb0| 20 66 72 6f 6d 0a 6c 75 | 6d 69 6e 61 6e 63 65 2d | from.lu|minance-|
|00001ec0| 63 68 72 6f 6d 69 6e 61 | 6e 63 65 20 63 6f 6c 6f |chromina|nce colo|
|00001ed0| 75 72 20 73 70 61 63 65 | 20 28 61 6b 61 20 59 43 |ur space| (aka YC|
|00001ee0| 72 43 62 2c 20 59 49 51 | 2c 20 6f 72 20 59 55 56 |rCb, YIQ|, or YUV|
|00001ef0| 2c 20 77 68 69 63 68 20 | 69 73 0a 68 6f 77 20 4d |, which |is.how M|
|00001f00| 50 45 47 20 73 74 72 65 | 61 6d 73 20 61 72 65 20 |PEG stre|ams are |
|00001f10| 65 6e 63 6f 64 65 64 20 | 61 6e 64 20 69 73 20 74 |encoded |and is t|
|00001f20| 68 65 20 73 61 6d 65 20 | 73 70 61 63 65 20 75 73 |he same |space us|
|00001f30| 65 64 20 62 79 20 4e 54 | 53 43 0a 74 65 6c 65 76 |ed by NT|SC.telev|
|00001f40| 69 73 69 6f 6e 20 73 69 | 67 6e 61 6c 73 29 20 74 |ision si|gnals) t|
|00001f50| 6f 20 73 6f 6d 65 20 66 | 6f 72 6d 20 6f 66 20 52 |o some f|orm of R|
|00001f60| 47 42 20 73 70 61 63 65 | 2e 20 20 54 68 65 20 69 |GB space|. The i|
|00001f70| 6d 70 6c 65 6d 65 6e 74 | 6f 72 73 20 6f 66 0a 5c |mplement|ors of.\|
|00001f80| 63 6f 64 65 7b 6d 70 65 | 67 5c 5f 70 6c 61 79 7d |code{mpe|g\_play}|
|00001f90| 20 66 6f 75 6e 64 20 74 | 68 61 74 20 6f 75 74 72 | found t|hat outr|
|00001fa0| 69 67 68 74 20 63 6f 6e | 76 65 72 73 69 6f 6e 20 |ight con|version |
|00001fb0| 74 6f 20 72 65 64 2f 67 | 72 65 65 6e 2f 62 6c 75 |to red/g|reen/blu|
|00001fc0| 65 0a 76 61 6c 75 65 73 | 20 74 61 6b 65 73 20 62 |e.values| takes b|
|00001fd0| 6f 74 68 20 6d 6f 72 65 | 20 74 69 6d 65 20 61 6e |oth more| time an|
|00001fe0| 64 20 6d 65 6d 6f 72 79 | 20 74 68 61 6e 20 61 6e |d memory| than an|
|00001ff0| 79 20 6f 74 68 65 72 20 | 6d 65 74 68 6f 64 20 74 |y other |method t|
|00002000| 68 65 79 0a 65 78 70 65 | 72 69 6d 65 6e 74 65 64 |hey.expe|rimented|
|00002010| 20 77 69 74 68 2c 20 73 | 6f 20 6d 6f 73 74 20 6d | with, s|o most m|
|00002020| 6f 64 65 73 20 61 72 65 | 20 63 6f 6c 6f 75 72 20 |odes are| colour |
|00002030| 6d 61 70 70 65 64 2e 20 | 20 54 68 69 73 20 6d 65 |mapped. | This me|
|00002040| 61 6e 73 20 74 68 61 74 | 0a 5c 63 6f 64 65 7b 4f |ans that|.\code{O|
|00002050| 70 65 6e 4d 50 45 47 28 | 29 7d 20 77 69 6c 6c 20 |penMPEG(|)} will |
|00002060| 63 72 65 61 74 65 20 61 | 6e 20 38 2d 62 69 74 20 |create a|n 8-bit |
|00002070| 63 6f 6c 6f 75 72 20 6d | 61 70 20 77 68 69 63 68 |colour m|ap which|
|00002080| 20 63 61 6e 20 62 65 0a | 61 63 63 65 73 73 65 64 | can be.|accessed|
|00002090| 20 62 79 20 74 68 65 20 | 75 73 65 72 20 76 69 61 | by the |user via|
|000020a0| 20 74 68 65 20 5c 63 6f | 64 65 7b 43 6f 6c 6f 72 | the \co|de{Color|
|000020b0| 6d 61 70 45 6e 74 72 79 | 7d 20 70 6f 69 6e 74 65 |mapEntry|} pointe|
|000020c0| 72 20 69 6e 0a 5c 63 6f | 64 65 7b 49 6d 61 67 65 |r in.\co|de{Image|
|000020d0| 44 65 73 63 7d 2c 20 61 | 6e 64 20 74 68 61 74 20 |Desc}, a|nd that |
|000020e0| 74 68 65 20 70 69 78 65 | 6c 20 76 61 6c 75 65 73 |the pixe|l values|
|000020f0| 20 72 65 74 75 72 6e 65 | 64 20 62 79 0a 5c 63 6f | returne|d by.\co|
|00002100| 64 65 7b 47 65 74 4d 50 | 45 47 46 72 61 6d 65 28 |de{GetMP|EGFrame(|
|00002110| 29 7d 20 61 72 65 20 69 | 6e 64 65 63 65 73 20 69 |)} are i|ndeces i|
|00002120| 6e 74 6f 20 74 68 69 73 | 20 63 6f 6c 6f 75 72 20 |nto this| colour |
|00002130| 6d 61 70 2e 20 20 54 68 | 65 20 64 69 74 68 65 72 |map. Th|e dither|
|00002140| 69 6e 67 0a 6d 6f 64 65 | 20 61 66 66 65 63 74 73 |ing.mode| affects|
|00002150| 20 74 68 65 20 71 75 61 | 6c 69 74 79 20 6f 66 20 | the qua|lity of |
|00002160| 74 68 65 20 64 65 63 6f | 64 65 64 20 69 6d 61 67 |the deco|ded imag|
|00002170| 65 73 2c 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f |es, the |number o|
|00002180| 66 20 62 69 74 73 0a 75 | 73 65 64 20 70 65 72 20 |f bits.u|sed per |
|00002190| 70 69 78 65 6c 2c 20 61 | 6e 64 20 74 68 65 20 63 |pixel, a|nd the c|
|000021a0| 6f 6c 6f 75 72 20 64 65 | 70 74 68 20 6f 66 20 74 |olour de|pth of t|
|000021b0| 68 65 20 69 6d 61 67 65 | 2e 0a 0a 54 68 65 20 64 |he image|...The d|
|000021c0| 69 74 68 65 72 69 6e 67 | 20 6d 6f 64 65 20 69 73 |ithering| mode is|
|000021d0| 20 73 65 6c 65 63 74 65 | 64 20 77 69 74 68 20 5c | selecte|d with \|
|000021e0| 63 6f 64 65 7b 53 65 74 | 4d 50 45 47 4f 70 74 69 |code{Set|MPEGOpti|
|000021f0| 6f 6e 28 29 7d 2c 20 75 | 73 69 6e 67 20 74 68 65 |on()}, u|sing the|
|00002200| 0a 5c 63 6f 64 65 7b 4d | 50 45 47 5c 5f 44 49 54 |.\code{M|PEG\_DIT|
|00002210| 48 45 52 7d 20 6f 70 74 | 69 6f 6e 20 61 6e 64 20 |HER} opt|ion and |
|00002220| 6f 6e 65 20 6f 66 20 74 | 68 65 20 66 6f 6c 6c 6f |one of t|he follo|
|00002230| 77 69 6e 67 20 76 61 6c | 75 65 73 3a 0a 5c 62 65 |wing val|ues:.\be|
|00002240| 67 69 6e 7b 74 74 64 65 | 73 63 72 69 70 74 69 6f |gin{ttde|scriptio|
|00002250| 6e 7d 7b 46 55 4c 4c 5c | 5f 43 4f 4c 4f 52 5c 5f |n}{FULL\|_COLOR\_|
|00002260| 44 49 54 48 45 52 7d 0a | 0a 5c 69 74 65 6d 5b 4f |DITHER}.|.\item[O|
|00002270| 52 44 45 52 45 44 5c 5f | 44 49 54 48 45 52 5d 20 |RDERED\_|DITHER] |
|00002280| 38 2d 62 69 74 20 63 6f | 6c 6f 75 72 2d 6d 61 70 |8-bit co|lour-map|
|00002290| 70 65 64 3b 20 72 65 61 | 73 6f 6e 61 62 6c 65 20 |ped; rea|sonable |
|000022a0| 71 75 61 6c 69 74 79 3b | 0a 20 20 64 65 63 6f 64 |quality;|. decod|
|000022b0| 69 6e 67 20 69 73 20 61 | 6c 6d 6f 73 74 20 61 73 |ing is a|lmost as|
|000022c0| 20 66 61 73 74 20 61 73 | 20 5c 63 6f 64 65 7b 47 | fast as| \code{G|
|000022d0| 52 41 59 5c 5f 44 49 54 | 48 45 52 7d 0a 5c 69 74 |RAY\_DIT|HER}.\it|
|000022e0| 65 6d 5b 4f 52 44 45 52 | 45 44 32 5c 5f 44 49 54 |em[ORDER|ED2\_DIT|
|000022f0| 48 45 52 5d 20 38 2d 62 | 69 74 20 63 6f 6c 6f 75 |HER] 8-b|it colou|
|00002300| 72 2d 6d 61 70 70 65 64 | 3b 20 72 65 61 73 6f 6e |r-mapped|; reason|
|00002310| 61 62 6c 65 20 71 75 61 | 6c 69 74 79 0a 5c 69 74 |able qua|lity.\it|
|00002320| 65 6d 5b 4d 42 4f 52 44 | 45 52 45 44 5c 5f 44 49 |em[MBORD|ERED\_DI|
|00002330| 54 48 45 52 5d 20 38 2d | 62 69 74 20 63 6f 6c 6f |THER] 8-|bit colo|
|00002340| 75 72 2d 6d 61 70 70 65 | 64 3b 20 72 65 61 73 6f |ur-mappe|d; reaso|
|00002350| 6e 61 62 6c 65 20 71 75 | 61 6c 69 74 79 0a 5c 69 |nable qu|ality.\i|
|00002360| 74 65 6d 5b 46 53 34 5c | 5f 44 49 54 48 45 52 5d |tem[FS4\|_DITHER]|
|00002370| 20 38 2d 62 69 74 20 63 | 6f 6c 6f 75 72 2d 6d 61 | 8-bit c|olour-ma|
|00002380| 70 70 65 64 3b 20 63 6f | 6c 6f 75 72 73 20 61 72 |pped; co|lours ar|
|00002390| 65 20 61 6c 6c 20 77 72 | 6f 6e 67 0a 5c 69 74 65 |e all wr|ong.\ite|
|000023a0| 6d 5b 46 53 32 5c 5f 44 | 49 54 48 45 52 5d 20 38 |m[FS2\_D|ITHER] 8|
|000023b0| 2d 62 69 74 20 63 6f 6c | 6f 75 72 2d 6d 61 70 70 |-bit col|our-mapp|
|000023c0| 65 64 3b 20 63 6f 6c 6f | 75 72 73 20 61 72 65 20 |ed; colo|urs are |
|000023d0| 61 6c 6c 20 77 72 6f 6e | 67 0a 5c 69 74 65 6d 5b |all wron|g.\item[|
|000023e0| 46 53 32 46 41 53 54 5c | 5f 44 49 54 48 45 52 5d |FS2FAST\|_DITHER]|
|000023f0| 20 38 2d 62 69 74 20 63 | 6f 6c 6f 75 72 20 6d 61 | 8-bit c|olour ma|
|00002400| 70 70 65 64 20 75 73 69 | 6e 67 20 46 6c 6f 79 64 |pped usi|ng Floyd|
|00002410| 2d 53 74 65 69 6e 62 65 | 72 67 20 65 72 72 6f 72 |-Steinbe|rg error|
|00002420| 0a 20 20 64 69 66 66 75 | 73 69 6f 6e 3b 20 72 65 |. diffu|sion; re|
|00002430| 61 73 6f 6e 61 62 6c 65 | 20 71 75 61 6c 69 74 79 |asonable| quality|
|00002440| 0a 5c 69 74 65 6d 5b 48 | 59 42 52 49 44 5c 5f 44 |.\item[H|YBRID\_D|
|00002450| 49 54 48 45 52 5d 20 38 | 2d 62 69 74 20 63 6f 6c |ITHER] 8|-bit col|
|00002460| 6f 75 72 2d 6d 61 70 70 | 65 64 3b 20 70 61 73 73 |our-mapp|ed; pass|
|00002470| 61 62 6c 65 20 63 6f 6c | 6f 75 72 0a 5c 69 74 65 |able col|our.\ite|
|00002480| 6d 5b 48 59 42 52 49 44 | 32 5c 5f 44 49 54 48 45 |m[HYBRID|2\_DITHE|
|00002490| 52 5d 20 38 2d 62 69 74 | 20 63 6f 6c 6f 75 72 2d |R] 8-bit| colour-|
|000024a0| 6d 61 70 70 65 64 3b 20 | 73 6c 69 67 68 74 6c 79 |mapped; |slightly|
|000024b0| 20 77 6f 72 73 65 20 74 | 68 61 6e 0a 20 20 5c 63 | worse t|han. \c|
|000024c0| 6f 64 65 7b 48 59 42 52 | 49 44 5c 5f 44 49 54 48 |ode{HYBR|ID\_DITH|
|000024d0| 45 52 7d 0a 5c 69 74 65 | 6d 5b 54 77 6f 78 32 5c |ER}.\ite|m[Twox2\|
|000024e0| 5f 44 49 54 48 45 52 5d | 20 38 2d 62 69 74 20 63 |_DITHER]| 8-bit c|
|000024f0| 6f 6c 6f 75 72 2d 6d 61 | 70 70 65 64 20 77 69 74 |olour-ma|pped wit|
|00002500| 68 20 70 69 78 65 6c 73 | 20 64 6f 75 62 6c 65 64 |h pixels| doubled|
|00002510| 3b 20 70 6f 6f 72 0a 20 | 20 71 75 61 6c 69 74 79 |; poor. | quality|
|00002520| 0a 5c 69 74 65 6d 5b 47 | 52 41 59 5c 5f 44 49 54 |.\item[G|RAY\_DIT|
|00002530| 48 45 52 5d 20 61 20 32 | 35 36 2d 73 68 61 64 65 |HER] a 2|56-shade|
|00002540| 20 67 72 61 79 73 63 61 | 6c 65 20 72 65 6e 64 65 | graysca|le rende|
|00002550| 72 69 6e 67 3b 20 6e 69 | 63 65 0a 20 20 71 75 61 |ring; ni|ce. qua|
|00002560| 6c 69 74 79 20 61 6e 64 | 20 66 61 73 74 65 73 74 |lity and| fastest|
|00002570| 20 64 65 63 6f 64 69 6e | 67 0a 5c 69 74 65 6d 5b | decodin|g.\item[|
|00002580| 46 55 4c 4c 5c 5f 43 4f | 4c 4f 52 5c 5f 44 49 54 |FULL\_CO|LOR\_DIT|
|00002590| 48 45 52 5d 20 61 20 68 | 69 67 68 2d 71 75 61 6c |HER] a h|igh-qual|
|000025a0| 69 74 79 20 32 34 2d 62 | 69 74 20 63 6f 6c 6f 75 |ity 24-b|it colou|
|000025b0| 72 20 72 65 6e 64 65 72 | 69 6e 67 3b 0a 20 20 72 |r render|ing;. r|
|000025c0| 65 73 75 6c 74 73 20 69 | 6e 20 73 6c 6f 77 65 73 |esults i|n slowes|
|000025d0| 74 20 64 65 63 6f 64 69 | 6e 67 0a 5c 69 74 65 6d |t decodi|ng.\item|
|000025e0| 5b 4d 4f 4e 4f 5c 5f 44 | 49 54 48 45 52 5d 20 31 |[MONO\_D|ITHER] 1|
|000025f0| 2d 62 69 74 20 6d 6f 6e | 6f 63 68 72 6f 6d 65 20 |-bit mon|ochrome |
|00002600| 64 69 74 68 65 72 69 6e | 67 3b 20 75 73 65 20 61 |ditherin|g; use a|
|00002610| 73 20 6c 61 73 74 20 72 | 65 73 6f 72 74 20 66 6f |s last r|esort fo|
|00002620| 72 0a 20 20 31 2d 62 69 | 74 20 64 69 73 70 6c 61 |r. 1-bi|t displa|
|00002630| 79 73 0a 5c 69 74 65 6d | 5b 54 48 52 45 53 48 4f |ys.\item|[THRESHO|
|00002640| 4c 44 5c 5f 44 49 54 48 | 45 52 5d 20 3f 3f 0a 5c |LD\_DITH|ER] ??.\|
|00002650| 65 6e 64 7b 74 74 64 65 | 73 63 72 69 70 74 69 6f |end{ttde|scriptio|
|00002660| 6e 7d 0a 54 68 65 20 64 | 65 73 63 72 69 70 74 69 |n}.The d|escripti|
|00002670| 6f 6e 73 20 68 65 72 65 | 20 61 72 65 20 6d 79 20 |ons here| are my |
|00002680| 65 6e 74 69 72 65 6c 79 | 20 73 75 62 6a 65 63 74 |entirely| subject|
|00002690| 69 76 65 20 6a 75 64 67 | 6d 65 6e 74 73 20 6f 66 |ive judg|ments of|
|000026a0| 20 74 68 65 0a 69 6d 61 | 67 65 20 71 75 61 6c 69 | the.ima|ge quali|
|000026b0| 74 79 20 77 69 74 68 20 | 65 61 63 68 20 64 69 74 |ty with |each dit|
|000026c0| 68 65 72 69 6e 67 20 6d | 6f 64 65 2e 20 20 60 60 |hering m|ode. ``|
|000026d0| 52 65 61 73 6f 6e 61 62 | 6c 65 27 27 20 71 75 61 |Reasonab|le'' qua|
|000026e0| 6c 69 74 79 20 69 73 0a | 62 65 74 74 65 72 20 74 |lity is.|better t|
|000026f0| 68 61 6e 20 60 60 70 61 | 73 73 61 62 6c 65 2e 27 |han ``pa|ssable.'|
|00002700| 27 20 20 59 6f 75 72 20 | 6d 69 6c 65 61 67 65 20 |' Your |mileage |
|00002710| 6d 61 79 20 76 61 72 79 | 2e 0a 0a 4e 6f 74 65 20 |may vary|...Note |
|00002720| 74 68 61 74 20 74 68 65 | 20 64 69 74 68 65 72 69 |that the| ditheri|
|00002730| 6e 67 20 6d 6f 64 65 20 | 6d 75 73 74 20 62 65 20 |ng mode |must be |
|00002740| 73 65 74 20 7b 5c 65 6d | 20 62 65 66 6f 72 65 5c |set {\em| before\|
|00002750| 2f 7d 20 5c 63 6f 64 65 | 7b 4f 70 65 6e 4d 50 45 |/} \code|{OpenMPE|
|00002760| 47 28 29 7d 0a 69 73 20 | 63 61 6c 6c 65 64 2e 20 |G()}.is |called. |
|00002770| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 74 6f | For exa|mple, to|
|00002780| 20 73 65 6c 65 63 74 20 | 67 72 61 79 2d 73 63 61 | select |gray-sca|
|00002790| 6c 65 20 64 69 74 68 65 | 72 69 6e 67 20 61 6e 64 |le dithe|ring and|
|000027a0| 20 74 68 65 6e 20 6f 70 | 65 6e 0a 74 68 65 20 66 | then op|en.the f|
|000027b0| 69 6c 65 20 5c 63 6f 64 | 65 7b 65 78 61 6d 70 6c |ile \cod|e{exampl|
|000027c0| 65 2e 6d 70 67 7d 20 61 | 73 20 61 6e 20 4d 50 45 |e.mpg} a|s an MPE|
|000027d0| 47 20 73 74 72 65 61 6d | 3a 0a 5c 62 65 67 69 6e |G stream|:.\begin|
|000027e0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 20 20 20 20 20 |{verbati|m}. |
|000027f0| 63 68 61 72 20 20 20 20 | 20 20 20 66 69 6c 65 6e |char | filen|
|00002800| 61 6d 65 5b 5d 20 3d 20 | 22 65 78 61 6d 70 6c 65 |ame[] = |"example|
|00002810| 2e 6d 70 67 22 3b 0a 20 | 20 20 20 20 46 49 4c 45 |.mpg";. | FILE|
|00002820| 20 20 20 20 20 20 20 2a | 6d 70 65 67 3b 0a 20 20 | *|mpeg;. |
|00002830| 20 20 20 49 6d 61 67 65 | 44 65 73 63 20 20 69 6d | Image|Desc im|
|00002840| 61 67 65 3b 0a 0a 20 20 | 20 20 20 6d 70 65 67 20 |age;.. | mpeg |
|00002850| 3d 20 66 6f 70 65 6e 20 | 28 66 69 6c 65 6e 61 6d |= fopen |(filenam|
|00002860| 65 2c 20 22 72 22 29 3b | 0a 20 20 20 20 20 53 65 |e, "r");|. Se|
|00002870| 74 4d 50 45 47 4f 70 74 | 69 6f 6e 20 28 4d 50 45 |tMPEGOpt|ion (MPE|
|00002880| 47 5f 44 49 54 48 45 52 | 2c 20 28 69 6e 74 29 20 |G_DITHER|, (int) |
|00002890| 47 52 41 59 5f 44 49 54 | 48 45 52 29 3b 0a 20 20 |GRAY_DIT|HER);. |
|000028a0| 20 20 20 4f 70 65 6e 4d | 50 45 47 20 28 26 69 6d | OpenM|PEG (&im|
|000028b0| 61 67 65 29 3b 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |age);.\e|nd{verba|
|000028c0| 74 69 6d 7d 0a 0a 5c 73 | 75 62 73 65 63 74 69 6f |tim}..\s|ubsectio|
|000028d0| 6e 7b 43 6f 6c 6f 75 72 | 20 6d 61 70 73 7d 0a 5c |n{Colour| maps}.\|
|000028e0| 6c 61 62 65 6c 7b 73 65 | 63 3a 63 6f 6c 6f 75 72 |label{se|c:colour|
|000028f0| 5f 6d 61 70 73 7d 0a 0a | 4d 6f 73 74 20 64 69 74 |_maps}..|Most dit|
|00002900| 68 65 72 69 6e 67 20 6d | 6f 64 65 73 20 72 65 73 |hering m|odes res|
|00002910| 75 6c 74 20 69 6e 20 69 | 6d 61 67 65 73 20 77 68 |ult in i|mages wh|
|00002920| 6f 73 65 20 70 69 78 65 | 6c 20 76 61 6c 75 65 73 |ose pixe|l values|
|00002930| 20 61 72 65 20 69 6e 64 | 65 63 65 73 20 74 6f 20 | are ind|eces to |
|00002940| 61 6e 0a 38 2d 62 69 74 | 20 63 6f 6c 6f 75 72 20 |an.8-bit| colour |
|00002950| 6d 61 70 2e 20 20 54 68 | 69 73 20 63 6f 6c 6f 75 |map. Th|is colou|
|00002960| 72 20 6d 61 70 20 69 73 | 20 61 63 63 65 73 73 65 |r map is| accesse|
|00002970| 64 20 76 69 61 20 74 68 | 65 20 5c 63 6f 64 65 7b |d via th|e \code{|
|00002980| 49 6d 61 67 65 44 65 73 | 63 7d 0a 73 74 72 75 63 |ImageDes|c}.struc|
|00002990| 74 75 72 65 2c 20 61 6e | 64 20 69 74 20 69 73 20 |ture, an|d it is |
|000029a0| 73 65 74 20 62 79 20 5c | 63 6f 64 65 7b 4f 70 65 |set by \|code{Ope|
|000029b0| 6e 4d 50 45 47 28 29 7d | 20 62 61 73 65 64 20 6f |nMPEG()}| based o|
|000029c0| 6e 20 74 68 65 20 64 69 | 74 68 65 72 69 6e 67 20 |n the di|thering |
|000029d0| 74 79 70 65 0a 73 65 6c | 65 63 74 65 64 20 62 79 |type.sel|ected by|
|000029e0| 20 5c 63 6f 64 65 7b 53 | 65 74 4d 50 45 47 4f 70 | \code{S|etMPEGOp|
|000029f0| 74 69 6f 6e 28 29 7d 20 | 28 74 68 69 73 20 69 73 |tion()} |(this is|
|00002a00| 20 77 68 79 20 74 68 65 | 20 64 69 74 68 65 72 69 | why the| ditheri|
|00002a10| 6e 67 20 74 79 70 65 20 | 6d 75 73 74 20 62 65 0a |ng type |must be.|
|00002a20| 73 65 74 20 62 65 66 6f | 72 65 20 63 61 6c 6c 69 |set befo|re calli|
|00002a30| 6e 67 20 5c 63 6f 64 65 | 7b 4f 70 65 6e 4d 50 45 |ng \code|{OpenMPE|
|00002a40| 47 28 29 7d 29 2e 0a 0a | 54 68 65 20 63 6f 6c 6f |G()})...|The colo|
|00002a50| 75 72 20 6d 61 70 20 69 | 73 20 61 63 63 65 73 73 |ur map i|s access|
|00002a60| 65 64 20 76 69 61 20 74 | 68 65 20 5c 63 6f 64 65 |ed via t|he \code|
|00002a70| 7b 43 6f 6c 6f 72 6d 61 | 70 7d 20 66 69 65 6c 64 |{Colorma|p} field|
|00002a80| 20 6f 66 0a 5c 63 6f 64 | 65 7b 49 6d 61 67 65 44 | of.\cod|e{ImageD|
|00002a90| 65 73 63 7d 2c 20 77 68 | 69 63 68 20 70 6f 69 6e |esc}, wh|ich poin|
|00002aa0| 74 73 20 74 6f 20 61 6e | 20 61 72 72 61 79 20 6f |ts to an| array o|
|00002ab0| 66 20 5c 63 6f 64 65 7b | 43 6f 6c 6f 72 6d 61 70 |f \code{|Colormap|
|00002ac0| 53 69 7a 65 7d 0a 63 6f | 6c 6f 75 72 20 6d 61 70 |Size}.co|lour map|
|00002ad0| 20 65 6e 74 72 69 65 73 | 2e 20 20 45 61 63 68 20 | entries|. Each |
|00002ae0| 63 6f 6c 6f 75 72 20 6d | 61 70 20 65 6e 74 72 79 |colour m|ap entry|
|00002af0| 20 69 73 20 61 20 73 74 | 72 75 63 74 75 72 65 20 | is a st|ructure |
|00002b00| 6f 66 20 74 68 65 20 66 | 6f 72 6d 0a 5c 62 65 67 |of the f|orm.\beg|
|00002b10| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 74 79 70 |in{verba|tim}.typ|
|00002b20| 65 64 65 66 20 73 74 72 | 75 63 74 0a 7b 0a 20 20 |edef str|uct.{. |
|00002b30| 20 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 72 | unsigne|d char r|
|00002b40| 65 64 2c 20 67 72 65 65 | 6e 2c 20 62 6c 75 65 3b |ed, gree|n, blue;|
|00002b50| 0a 7d 20 43 6f 6c 6f 72 | 6d 61 70 45 6e 74 72 79 |.} Color|mapEntry|
|00002b60| 3b 0a 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d |;.\end{v|erbatim}|
|00002b70| 0a 61 6e 64 20 74 68 65 | 20 63 6f 6c 6f 75 72 20 |.and the| colour |
|00002b80| 6d 61 70 20 69 73 20 63 | 72 65 61 74 65 64 20 77 |map is c|reated w|
|00002b90| 68 65 6e 20 5c 63 6f 64 | 65 7b 4f 70 65 6e 4d 50 |hen \cod|e{OpenMP|
|00002ba0| 45 47 28 29 7d 20 69 73 | 20 63 61 6c 6c 65 64 2e |EG()} is| called.|
|00002bb0| 20 20 49 66 20 6e 6f 0a | 63 6f 6c 6f 75 72 20 6d | If no.|colour m|
|00002bc0| 61 70 20 69 73 20 63 72 | 65 61 74 65 64 20 28 69 |ap is cr|eated (i|
|00002bd0| 2e 65 2e 2c 20 74 68 65 | 20 64 69 74 68 65 72 69 |.e., the| ditheri|
|00002be0| 6e 67 20 6d 6f 64 65 20 | 69 73 0a 5c 63 6f 64 65 |ng mode |is.\code|
|00002bf0| 7b 46 55 4c 4c 5c 5f 43 | 4f 4c 4f 52 5c 5f 44 49 |{FULL\_C|OLOR\_DI|
|00002c00| 54 48 45 52 7d 29 2c 20 | 74 68 65 6e 20 5c 63 6f |THER}), |then \co|
|00002c10| 64 65 7b 43 6f 6c 6f 72 | 6d 61 70 53 69 7a 65 7d |de{Color|mapSize}|
|00002c20| 20 77 69 6c 6c 20 62 65 | 20 30 20 61 6e 64 0a 5c | will be| 0 and.\|
|00002c30| 63 6f 64 65 7b 43 6f 6c | 6f 72 6d 61 70 7d 20 77 |code{Col|ormap} w|
|00002c40| 69 6c 6c 20 62 65 20 5c | 63 6f 64 65 7b 4e 55 4c |ill be \|code{NUL|
|00002c50| 4c 7d 2e 20 20 46 6f 72 | 20 65 78 61 6d 70 6c 65 |L}. For| example|
|00002c60| 3a 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |:.\begin|{verbati|
|00002c70| 6d 7d 0a 20 20 20 63 68 | 61 72 20 20 20 20 20 20 |m}. ch|ar |
|00002c80| 2a 66 69 6c 65 6e 61 6d | 65 3b 0a 20 20 20 46 49 |*filenam|e;. FI|
|00002c90| 4c 45 20 20 20 20 20 20 | 2a 4d 50 45 47 3b 0a 20 |LE |*MPEG;. |
|00002ca0| 20 20 49 6d 61 67 65 44 | 65 73 63 20 4d 50 45 47 | ImageD|esc MPEG|
|00002cb0| 49 6e 66 6f 3b 0a 0a 20 | 20 20 66 69 6c 65 6e 61 |Info;.. | filena|
|00002cc0| 6d 65 20 3d 20 61 72 67 | 76 5b 31 5d 3b 0a 0a 20 |me = arg|v[1];.. |
|00002cd0| 20 20 2f 2a 20 50 72 65 | 70 61 72 65 20 74 6f 20 | /* Pre|pare to |
|00002ce0| 72 65 61 64 20 61 6e 64 | 20 64 65 63 6f 64 65 20 |read and| decode |
|00002cf0| 61 6e 20 4d 50 45 47 20 | 73 74 72 65 61 6d 20 2a |an MPEG |stream *|
|00002d00| 2f 0a 0a 20 20 20 4d 50 | 45 47 20 3d 20 66 6f 70 |/.. MP|EG = fop|
|00002d10| 65 6e 20 28 66 69 6c 65 | 6e 61 6d 65 2c 20 22 72 |en (file|name, "r|
|00002d20| 62 22 29 3b 0a 20 20 20 | 69 66 20 28 21 4f 70 65 |b");. |if (!Ope|
|00002d30| 6e 4d 50 45 47 20 28 4d | 50 45 47 2c 20 26 4d 50 |nMPEG (M|PEG, &MP|
|00002d40| 45 47 49 6e 66 6f 29 29 | 0a 20 20 20 20 20 20 65 |EGInfo))|. e|
|00002d50| 78 69 74 3b 0a 0a 20 20 | 20 2f 2a 20 44 6f 20 77 |xit;.. | /* Do w|
|00002d60| 65 20 68 61 76 65 20 61 | 20 63 6f 6c 6f 75 72 2d |e have a| colour-|
|00002d70| 6d 61 70 70 65 64 20 6d | 6f 64 65 3f 20 2a 2f 0a |mapped m|ode? */.|
|00002d80| 0a 20 20 20 69 66 20 28 | 4d 50 45 47 49 6e 66 6f |. if (|MPEGInfo|
|00002d90| 2e 43 6f 6c 6f 72 6d 61 | 70 20 21 3d 20 4e 55 4c |.Colorma|p != NUL|
|00002da0| 4c 29 0a 20 20 20 7b 0a | 20 20 20 20 20 20 66 6f |L). {.| fo|
|00002db0| 72 20 28 69 20 3d 20 30 | 3b 20 69 20 3c 20 4d 50 |r (i = 0|; i < MP|
|00002dc0| 45 47 49 6e 66 6f 2e 43 | 6f 6c 6f 72 6d 61 70 53 |EGInfo.C|olormapS|
|00002dd0| 69 7a 65 3b 20 69 2b 2b | 29 0a 20 20 20 20 20 20 |ize; i++|). |
|00002de0| 7b 0a 20 20 20 20 20 20 | 20 20 20 6d 61 70 63 6f |{. | mapco|
|00002df0| 6c 6f 72 20 28 69 2c 20 | 4d 50 45 47 49 6e 66 6f |lor (i, |MPEGInfo|
|00002e00| 2e 43 6f 6c 6f 72 6d 61 | 70 5b 69 5d 2e 72 65 64 |.Colorma|p[i].red|
|00002e10| 2c 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |,. | |
|00002e20| 20 20 20 20 20 20 20 20 | 4d 50 45 47 49 6e 66 6f | |MPEGInfo|
|00002e30| 2e 43 6f 6c 6f 72 6d 61 | 70 5b 69 5d 2e 67 72 65 |.Colorma|p[i].gre|
|00002e40| 65 6e 2c 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |en,. | |
|00002e50| 20 20 20 20 20 20 20 20 | 20 20 4d 50 45 47 49 6e | | MPEGIn|
|00002e60| 66 6f 2e 43 6f 6c 6f 72 | 6d 61 70 5b 69 5d 2e 62 |fo.Color|map[i].b|
|00002e70| 6c 75 65 29 3b 0a 20 20 | 20 20 20 20 7d 0a 20 20 |lue);. | }. |
|00002e80| 20 7d 0a 20 20 20 2f 2a | 20 2e 2e 2e 20 2a 2f 0a | }. /*| ... */.|
|00002e90| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 48 |\end{ver|batim}.H|
|00002ea0| 65 72 65 2c 20 77 65 20 | 61 73 73 75 6d 65 20 74 |ere, we |assume t|
|00002eb0| 68 61 74 20 74 68 65 20 | 66 75 6e 63 74 69 6f 6e |hat the |function|
|00002ec0| 20 5c 63 6f 64 65 7b 6d | 61 70 63 6f 6c 6f 72 28 | \code{m|apcolor(|
|00002ed0| 29 7d 20 69 73 20 61 76 | 61 69 6c 61 62 6c 65 20 |)} is av|ailable |
|00002ee0| 74 6f 0a 73 65 74 20 74 | 68 65 20 73 79 73 74 65 |to.set t|he syste|
|00002ef0| 6d 20 63 6f 6c 6f 75 72 | 20 6d 61 70 2e 0a 0a 25 |m colour| map...%|
|00002f00| 20 4e 4f 54 45 20 74 6f | 20 73 65 6c 66 3a 20 63 | NOTE to| self: c|
|00002f10| 68 65 63 6b 20 68 6f 77 | 20 6d 70 65 67 5f 70 6c |heck how| mpeg_pl|
|00002f20| 61 79 20 67 65 6e 65 72 | 61 74 65 73 20 63 6f 6c |ay gener|ates col|
|00002f30| 6f 75 72 20 6d 61 70 73 | 20 61 67 61 69 6e 3b 0a |our maps| again;.|
|00002f40| 25 20 61 66 74 65 72 20 | 61 6c 6c 2c 20 69 74 73 |% after |all, its|
|00002f50| 20 70 69 78 65 6c 20 76 | 61 6c 75 65 73 20 61 72 | pixel v|alues ar|
|00002f60| 65 20 38 20 62 69 74 73 | 20 74 6f 6f 2c 20 73 6f |e 8 bits| too, so|
|00002f70| 20 69 74 20 63 61 6e 27 | 74 20 62 65 20 75 73 69 | it can'|t be usi|
|00002f80| 6e 67 0a 25 20 61 20 68 | 75 67 65 20 63 6f 6c 6f |ng.% a h|uge colo|
|00002f90| 75 72 20 6d 61 70 20 74 | 6f 20 6b 65 65 70 20 66 |ur map t|o keep f|
|00002fa0| 72 6f 6d 20 63 6c 6f 62 | 62 65 72 69 6e 67 20 58 |rom clob|bering X|
|00002fb0| 27 73 2e 20 20 50 72 6f | 62 6c 65 6d 20 62 61 73 |'s. Pro|blem bas|
|00002fc0| 69 63 61 6c 6c 79 0a 25 | 20 69 73 20 74 68 61 74 |ically.%| is that|
|00002fd0| 20 67 72 61 79 73 63 61 | 6c 65 20 64 69 74 68 65 | graysca|le dithe|
|00002fe0| 72 69 6e 67 20 75 73 65 | 73 20 61 20 32 35 36 2d |ring use|s a 256-|
|00002ff0| 65 6c 74 2e 20 63 6f 6c | 6f 75 72 20 6d 61 70 2c |elt. col|our map,|
|00003000| 20 77 68 69 63 68 20 63 | 6c 6f 62 62 65 72 73 73 | which c|lobberss|
|00003010| 0a 25 20 74 68 65 20 73 | 79 73 74 65 6d 20 6d 61 |.% the s|ystem ma|
|00003020| 70 20 6f 6e 20 74 68 65 | 20 34 44 33 35 27 73 20 |p on the| 4D35's |
|00003030| 2d 2d 20 6f 6e 20 49 6e | 64 79 27 73 20 74 6f 6f |-- on In|dy's too|
|00003040| 3f 20 20 70 6f 72 74 69 | 61 3f 0a 0a 25 41 63 74 |? porti|a?..%Act|
|00003050| 75 61 6c 6c 79 2c 20 74 | 68 65 20 73 69 74 75 61 |ually, t|he situa|
|00003060| 74 69 6f 6e 20 69 73 20 | 73 6c 69 67 68 74 6c 79 |tion is |slightly|
|00003070| 20 6d 6f 72 65 20 63 6f | 6d 70 6c 69 63 61 74 65 | more co|mplicate|
|00003080| 64 3a 20 69 66 20 69 74 | 20 77 65 72 65 20 6c 69 |d: if it| were li|
|00003090| 74 65 72 61 6c 6c 79 0a | 25 6c 69 6b 65 20 74 68 |terally.|%like th|
|000030a0| 69 73 2c 20 74 68 65 6e | 20 70 72 6f 67 72 61 6d |is, then| program|
|000030b0| 73 20 74 68 61 74 20 75 | 73 65 20 74 68 65 20 4d |s that u|se the M|
|000030c0| 50 45 47 20 4c 69 62 72 | 61 72 79 20 77 6f 75 6c |PEG Libr|ary woul|
|000030d0| 64 20 62 65 20 73 74 75 | 63 6b 20 77 69 74 68 0a |d be stu|ck with.|
|000030e0| 25 75 73 69 6e 67 20 65 | 6e 74 72 69 65 73 20 30 |%using e|ntries 0|
|000030f0| 2d 32 35 35 20 28 6f 72 | 20 30 2d 31 32 37 2c 20 |-255 (or| 0-127, |
|00003100| 64 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 74 68 65 |dependin|g on the|
|00003110| 20 64 69 74 68 65 72 69 | 6e 67 20 6d 6f 64 65 29 | ditheri|ng mode)|
|00003120| 20 6f 66 20 74 68 65 0a | 25 73 79 73 74 65 6d 20 | of the.|%system |
|00003130| 63 6f 6c 6f 75 72 20 6d | 61 70 2e 20 20 4f 6e 20 |colour m|ap. On |
|00003140| 77 69 6e 64 6f 77 65 64 | 20 73 79 73 74 65 6d 73 |windowed| systems|
|00003150| 20 73 75 63 68 20 61 73 | 20 58 20 57 69 6e 64 6f | such as| X Windo|
|00003160| 77 73 2c 20 74 68 69 73 | 20 69 73 20 6f 66 74 65 |ws, this| is ofte|
|00003170| 6e 0a 25 75 6e 64 65 73 | 69 72 61 62 6c 65 2c 20 |n.%undes|irable, |
|00003180| 61 73 20 69 74 20 6d 69 | 67 68 74 20 63 6c 6f 62 |as it mi|ght clob|
|00003190| 62 65 72 20 63 6f 6c 6f | 75 72 20 6d 61 70 20 65 |ber colo|ur map e|
|000031a0| 6e 74 72 69 65 73 20 75 | 73 65 64 20 62 79 20 74 |ntries u|sed by t|
|000031b0| 68 65 20 73 79 73 74 65 | 6d 20 6f 72 0a 25 6f 74 |he syste|m or.%ot|
|000031c0| 68 65 72 20 70 72 6f 67 | 72 61 6d 73 2e 20 20 54 |her prog|rams. T|
|000031d0| 68 75 73 2c 20 74 68 65 | 20 4d 50 45 47 20 4c 69 |hus, the| MPEG Li|
|000031e0| 62 72 61 72 79 20 70 72 | 6f 76 69 64 65 73 20 61 |brary pr|ovides a|
|000031f0| 20 6d 65 63 68 61 6e 69 | 73 6d 20 66 6f 72 20 6d | mechani|sm for m|
|00003200| 61 70 70 69 6e 67 0a 25 | 60 60 69 64 65 61 6c 27 |apping.%|``ideal'|
|00003210| 27 20 63 6f 6c 6f 75 72 | 20 6d 61 70 20 69 6e 64 |' colour| map ind|
|00003220| 65 63 65 73 20 28 77 68 | 69 63 68 20 61 72 65 20 |eces (wh|ich are |
|00003230| 69 6e 20 74 68 65 20 72 | 61 6e 67 65 20 30 2e 2e |in the r|ange 0..|
|00003240| 31 32 37 20 6f 72 20 32 | 35 35 29 20 74 6f 20 0a |127 or 2|55) to .|
|00003250| 25 72 65 61 6c 2d 77 6f | 72 6c 64 20 63 6f 6c 6f |%real-wo|rld colo|
|00003260| 75 72 20 6d 61 70 20 69 | 6e 64 65 63 65 73 2e 20 |ur map i|ndeces. |
|00003270| 20 54 68 69 73 20 0a 0a | 5c 73 75 62 73 65 63 74 | This ..|\subsect|
|00003280| 69 6f 6e 7b 49 6d 61 67 | 65 20 64 61 74 61 20 66 |ion{Imag|e data f|
|00003290| 6f 72 6d 61 74 7d 0a 5c | 6c 61 62 65 6c 7b 73 65 |ormat}.\|label{se|
|000032a0| 63 3a 69 6d 61 67 65 5f | 64 61 74 61 7d 0a 0a 54 |c:image_|data}..T|
|000032b0| 68 65 20 69 6d 61 67 65 | 20 64 61 74 61 2c 20 61 |he image| data, a|
|000032c0| 73 20 72 65 74 75 72 6e | 65 64 20 62 79 20 5c 63 |s return|ed by \c|
|000032d0| 6f 64 65 7b 47 65 74 4d | 50 45 47 46 72 61 6d 65 |ode{GetM|PEGFrame|
|000032e0| 28 29 7d 2c 20 69 73 20 | 66 6f 72 6d 61 74 74 65 |()}, is |formatte|
|000032f0| 64 20 69 6e 0a 61 20 73 | 74 72 61 69 67 68 74 66 |d in.a s|traightf|
|00003300| 6f 72 77 61 72 64 20 77 | 61 79 2e 20 20 50 69 78 |orward w|ay. Pix|
|00003310| 65 6c 73 20 61 72 65 20 | 73 74 6f 72 65 64 20 69 |els are |stored i|
|00003320| 6e 20 72 6f 77 2d 6d 61 | 6a 6f 72 20 6f 72 64 65 |n row-ma|jor orde|
|00003330| 72 2c 20 73 74 61 72 74 | 69 6e 67 0a 61 74 20 74 |r, start|ing.at t|
|00003340| 68 65 20 75 70 70 65 72 | 20 6c 65 66 74 2d 68 61 |he upper| left-ha|
|00003350| 6e 64 20 63 6f 72 6e 65 | 72 20 6f 66 20 74 68 65 |nd corne|r of the|
|00003360| 20 69 6d 61 67 65 2e 20 | 20 54 68 65 20 6e 75 6d | image. | The num|
|00003370| 62 65 72 20 6f 66 20 62 | 69 74 73 0a 61 6c 6c 6f |ber of b|its.allo|
|00003380| 63 61 74 65 64 20 70 65 | 72 20 70 69 78 65 6c 20 |cated pe|r pixel |
|00003390| 69 73 20 67 69 76 65 6e | 20 62 79 20 74 68 65 20 |is given| by the |
|000033a0| 5c 63 6f 64 65 7b 50 69 | 78 65 6c 53 69 7a 65 7d |\code{Pi|xelSize}|
|000033b0| 20 66 69 65 6c 64 20 6f | 66 0a 5c 63 6f 64 65 7b | field o|f.\code{|
|000033c0| 49 6d 61 67 65 44 65 73 | 63 7d 2e 20 20 54 68 69 |ImageDes|c}. Thi|
|000033d0| 73 20 69 73 20 69 6c 6c | 75 73 74 72 61 74 65 64 |s is ill|ustrated|
|000033e0| 20 69 6e 0a 46 69 67 75 | 72 65 7e 5c 72 65 66 7b | in.Figu|re~\ref{|
|000033f0| 66 69 67 3a 69 6d 61 67 | 65 5f 66 6f 72 6d 61 74 |fig:imag|e_format|
|00003400| 7d 2c 20 77 68 69 63 68 | 20 73 68 6f 77 73 20 61 |}, which| shows a|
|00003410| 20 73 61 6d 70 6c 65 20 | 24 38 20 5c 74 69 6d 65 | sample |$8 \time|
|00003420| 73 0a 31 30 24 2d 70 69 | 78 65 6c 20 69 6d 61 67 |s.10$-pi|xel imag|
|00003430| 65 2c 20 77 69 74 68 20 | 74 68 65 20 6f 66 66 73 |e, with |the offs|
|00003440| 65 74 20 69 6e 74 6f 20 | 74 68 65 20 69 6d 61 67 |et into |the imag|
|00003450| 65 20 64 61 74 61 20 66 | 6f 72 20 65 61 63 68 20 |e data f|or each |
|00003460| 70 69 78 65 6c 2e 0a 49 | 66 20 74 68 65 20 70 69 |pixel..I|f the pi|
|00003470| 78 65 6c 73 20 61 72 65 | 20 38 20 62 69 74 73 20 |xels are| 8 bits |
|00003480| 65 61 63 68 2c 20 74 68 | 65 6e 20 74 68 69 73 20 |each, th|en this |
|00003490| 77 69 6c 6c 20 62 65 20 | 61 20 73 69 6d 70 6c 65 |will be |a simple|
|000034a0| 20 62 79 74 65 20 6f 66 | 66 73 65 74 2e 0a 0a 5c | byte of|fset...\|
|000034b0| 62 65 67 69 6e 7b 66 69 | 67 75 72 65 7d 5b 68 74 |begin{fi|gure}[ht|
|000034c0| 62 70 5d 0a 20 20 5c 63 | 65 6e 74 65 72 6c 69 6e |bp]. \c|enterlin|
|000034d0| 65 7b 5c 70 73 66 69 67 | 7b 66 69 67 75 72 65 3d |e{\psfig|{figure=|
|000034e0| 69 6d 61 67 65 5f 66 6f | 72 6d 61 74 2e 65 70 73 |image_fo|rmat.eps|
|000034f0| 7d 7d 0a 20 20 5c 63 61 | 70 74 69 6f 6e 7b 49 6c |}}. \ca|ption{Il|
|00003500| 6c 75 73 74 72 61 74 69 | 6f 6e 20 6f 66 20 69 6d |lustrati|on of im|
|00003510| 61 67 65 20 64 61 74 61 | 20 6c 61 79 6f 75 74 20 |age data| layout |
|00003520| 66 6f 72 20 61 20 73 61 | 6d 70 6c 65 20 24 38 20 |for a sa|mple $8 |
|00003530| 5c 74 69 6d 65 73 20 31 | 30 24 0a 20 20 20 20 69 |\times 1|0$. i|
|00003540| 6d 61 67 65 2e 20 20 54 | 68 65 20 6e 75 6d 62 65 |mage. T|he numbe|
|00003550| 72 20 61 74 20 65 61 63 | 68 20 70 69 78 65 6c 20 |r at eac|h pixel |
|00003560| 69 73 20 6a 75 73 74 20 | 74 68 65 20 6f 66 66 73 |is just |the offs|
|00003570| 65 74 20 69 6e 74 6f 20 | 74 68 65 20 69 6d 61 67 |et into |the imag|
|00003580| 65 0a 20 20 20 20 64 61 | 74 61 20 61 72 72 61 79 |e. da|ta array|
|00003590| 2e 7d 0a 20 20 5c 6c 61 | 62 65 6c 7b 66 69 67 3a |.}. \la|bel{fig:|
|000035a0| 69 6d 61 67 65 5f 66 6f | 72 6d 61 74 7d 0a 5c 65 |image_fo|rmat}.\e|
|000035b0| 6e 64 7b 66 69 67 75 72 | 65 7d 0a 0a 0a 5c 73 65 |nd{figur|e}...\se|
|000035c0| 63 74 69 6f 6e 7b 50 72 | 6f 67 72 61 6d 6d 69 6e |ction{Pr|ogrammin|
|000035d0| 67 20 52 65 66 65 72 65 | 6e 63 65 7d 0a 0a 5c 73 |g Refere|nce}..\s|
|000035e0| 75 62 73 65 63 74 69 6f | 6e 7b 54 68 65 20 5c 63 |ubsectio|n{The \c|
|000035f0| 6f 64 65 7b 49 6d 61 67 | 65 44 65 73 63 7d 20 73 |ode{Imag|eDesc} s|
|00003600| 74 72 75 63 74 75 72 65 | 7d 0a 52 65 6c 65 76 61 |tructure|}.Releva|
|00003610| 6e 74 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 73 3a |nt decla|rations:|
|00003620| 0a 5c 62 65 67 69 6e 7b | 76 65 72 62 61 74 69 6d |.\begin{|verbatim|
|00003630| 7d 0a 74 79 70 65 64 65 | 66 20 73 74 72 75 63 74 |}.typede|f struct|
|00003640| 0a 7b 0a 20 20 20 75 6e | 73 69 67 6e 65 64 20 63 |.{. un|signed c|
|00003650| 68 61 72 20 72 65 64 2c | 20 67 72 65 65 6e 2c 20 |har red,| green, |
|00003660| 62 6c 75 65 3b 0a 7d 20 | 43 6f 6c 6f 72 6d 61 70 |blue;.} |Colormap|
|00003670| 45 6e 74 72 79 3b 0a 0a | 74 79 70 65 64 65 66 20 |Entry;..|typedef |
|00003680| 73 74 72 75 63 74 0a 7b | 0a 20 20 20 69 6e 74 20 |struct.{|. int |
|00003690| 20 48 65 69 67 68 74 3b | 20 20 20 20 20 20 20 20 | Height;| |
|000036a0| 20 20 20 20 20 2f 2a 20 | 69 6e 20 70 69 78 65 6c | /* |in pixel|
|000036b0| 73 20 2a 2f 0a 20 20 20 | 69 6e 74 20 20 57 69 64 |s */. |int Wid|
|000036c0| 74 68 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |th; | |
|000036d0| 20 0a 20 20 20 69 6e 74 | 20 20 44 65 70 74 68 3b | . int| Depth;|
|000036e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a | | /*|
|000036f0| 20 69 6d 61 67 65 20 64 | 65 70 74 68 20 28 62 69 | image d|epth (bi|
|00003700| 74 73 29 20 2a 2f 0a 20 | 20 20 69 6e 74 20 20 50 |ts) */. | int P|
|00003710| 69 78 65 6c 53 69 7a 65 | 3b 20 20 20 20 20 20 20 |ixelSize|; |
|00003720| 20 20 20 2f 2a 20 62 69 | 74 73 20 61 63 74 75 61 | /* bi|ts actua|
|00003730| 6c 6c 79 20 73 74 6f 72 | 65 64 20 70 65 72 20 70 |lly stor|ed per p|
|00003740| 69 78 65 6c 20 2a 2f 0a | 20 20 20 69 6e 74 20 20 |ixel */.| int |
|00003750| 53 69 7a 65 3b 20 20 20 | 20 20 20 20 20 20 20 20 |Size; | |
|00003760| 20 20 20 20 2f 2a 20 62 | 79 74 65 73 20 66 6f 72 | /* b|ytes for|
|00003770| 20 77 68 6f 6c 65 20 69 | 6d 61 67 65 20 2a 2f 0a | whole i|mage */.|
|00003780| 20 20 20 69 6e 74 20 20 | 42 69 74 6d 61 70 50 61 | int |BitmapPa|
|00003790| 64 3b 20 20 20 20 20 20 | 20 20 20 20 2f 2a 20 22 |d; | /* "|
|000037a0| 71 75 61 6e 74 75 6d 22 | 20 6f 66 20 61 20 73 63 |quantum"| of a sc|
|000037b0| 61 6e 6c 69 6e 65 20 2d | 2d 20 2a 2f 0a 20 20 20 |anline -|- */. |
|000037c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000037d0| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 65 61 63 68 | | /* each|
|000037e0| 20 73 63 61 6e 6c 69 6e | 65 20 73 74 61 72 74 73 | scanlin|e starts|
|000037f0| 20 6f 6e 20 61 6e 20 65 | 76 65 6e 20 2a 2f 0a 20 | on an e|ven */. |
|00003800| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003810| 20 20 20 20 20 20 20 20 | 20 20 20 2f 2a 20 69 6e | | /* in|
|00003820| 74 65 72 76 61 6c 20 6f | 66 20 74 68 69 73 20 6d |terval o|f this m|
|00003830| 61 6e 79 20 62 69 74 73 | 20 2a 2f 0a 20 20 20 69 |any bits| */. i|
|00003840| 6e 74 20 20 43 6f 6c 6f | 72 6d 61 70 53 69 7a 65 |nt Colo|rmapSize|
|00003850| 3b 20 20 20 20 20 0a 20 | 20 20 43 6f 6c 6f 72 6d |; . | Colorm|
|00003860| 61 70 45 6e 74 72 79 20 | 2a 43 6f 6c 6f 72 6d 61 |apEntry |*Colorma|
|00003870| 70 3b 20 2f 2a 20 61 6e | 20 61 72 72 61 79 20 6f |p; /* an| array o|
|00003880| 66 20 43 6f 6c 6f 72 6d | 61 70 53 69 7a 65 20 65 |f Colorm|apSize e|
|00003890| 6e 74 72 69 65 73 20 2a | 2f 0a 7d 20 49 6d 61 67 |ntries *|/.} Imag|
|000038a0| 65 44 65 73 63 3b 0a 5c | 65 6e 64 7b 76 65 72 62 |eDesc;.\|end{verb|
|000038b0| 61 74 69 6d 7d 0a 0a 54 | 68 69 73 20 73 74 72 75 |atim}..T|his stru|
|000038c0| 63 74 75 72 65 20 70 72 | 6f 76 69 64 65 73 20 28 |cture pr|ovides (|
|000038d0| 68 6f 70 65 66 75 6c 6c | 79 29 20 61 6c 6c 20 74 |hopefull|y) all t|
|000038e0| 68 65 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 6e |he infor|mation n|
|000038f0| 65 65 64 65 64 20 74 6f | 0a 64 69 73 70 6c 61 79 |eeded to|.display|
|00003900| 20 61 6e 20 4d 50 45 47 | 20 73 74 72 65 61 6d 2c | an MPEG| stream,|
|00003910| 20 61 6c 74 68 6f 75 67 | 68 20 69 74 20 64 6f 65 | althoug|h it doe|
|00003920| 73 6e 27 74 20 6e 65 63 | 65 73 73 61 72 69 6c 79 |sn't nec|essarily|
|00003930| 20 70 72 6f 76 69 64 65 | 20 61 6c 6c 0a 74 68 65 | provide| all.the|
|00003940| 20 69 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 79 6f 75 | informa|tion you|
|00003950| 20 63 6f 75 6c 64 20 70 | 6f 73 73 69 62 6c 79 20 | could p|ossibly |
|00003960| 77 61 6e 74 20 74 6f 20 | 6b 6e 6f 77 20 61 62 6f |want to |know abo|
|00003970| 75 74 20 73 75 63 68 20 | 61 20 73 74 72 65 61 6d |ut such |a stream|
|00003980| 2e 0a 48 6f 77 65 76 65 | 72 2c 20 74 68 61 74 27 |..Howeve|r, that'|
|00003990| 73 20 6e 6f 74 20 74 68 | 65 20 69 6e 74 65 6e 74 |s not th|e intent|
|000039a0| 20 6f 66 20 74 68 65 20 | 4d 50 45 47 20 4c 69 62 | of the |MPEG Lib|
|000039b0| 72 61 72 79 3b 20 69 66 | 20 79 6f 75 20 72 65 61 |rary; if| you rea|
|000039c0| 6c 6c 79 20 6e 65 65 64 | 0a 74 6f 20 6b 6e 6f 77 |lly need|.to know|
|000039d0| 2c 20 66 6f 72 20 69 6e | 73 74 61 6e 63 65 2c 20 |, for in|stance, |
|000039e0| 6a 75 73 74 20 68 6f 77 | 20 6d 61 6e 79 20 69 6e |just how| many in|
|000039f0| 74 72 61 2d 66 72 61 6d | 65 73 20 61 72 65 20 69 |tra-fram|es are i|
|00003a00| 6e 20 61 20 70 61 72 74 | 69 63 75 6c 61 72 0a 4d |n a part|icular.M|
|00003a10| 50 45 47 2c 20 79 6f 75 | 20 6d 69 67 68 74 20 77 |PEG, you| might w|
|00003a20| 61 6e 74 20 74 6f 20 74 | 61 6b 65 20 61 20 6c 6f |ant to t|ake a lo|
|00003a30| 6f 6b 20 61 74 20 74 68 | 65 20 5c 63 6f 64 65 7b |ok at th|e \code{|
|00003a40| 6d 70 65 67 73 74 61 74 | 7d 20 70 72 6f 67 72 61 |mpegstat|} progra|
|00003a50| 6d 2c 0a 77 68 69 63 68 | 20 77 61 73 20 61 6c 73 |m,.which| was als|
|00003a60| 6f 20 62 61 73 65 64 20 | 6f 6e 20 74 68 65 20 42 |o based |on the B|
|00003a70| 65 72 6b 65 6c 65 79 20 | 58 31 31 20 70 6c 61 79 |erkeley |X11 play|
|00003a80| 65 72 2e 25 0a 5c 66 6f | 6f 74 6e 6f 74 65 7b 5c |er.%.\fo|otnote{\|
|00003a90| 63 6f 64 65 7b 6d 70 65 | 67 73 74 61 74 7d 20 73 |code{mpe|gstat} s|
|00003aa0| 68 6f 75 6c 64 20 61 6c | 73 6f 20 62 65 20 61 76 |hould al|so be av|
|00003ab0| 61 69 6c 61 62 6c 65 20 | 62 79 20 61 6e 6f 6e 79 |ailable |by anony|
|00003ac0| 6d 6f 75 73 20 66 74 70 | 0a 20 20 66 72 6f 6d 20 |mous ftp|. from |
|00003ad0| 5c 63 6f 64 65 7b 66 74 | 70 2e 6d 6e 69 2e 6d 63 |\code{ft|p.mni.mc|
|00003ae0| 67 69 6c 6c 2e 63 61 3a | 2f 70 75 62 2f 6d 70 65 |gill.ca:|/pub/mpe|
|00003af0| 67 7d 2e 7d 0a 0a 48 65 | 72 65 20 69 73 20 74 68 |g}.}..He|re is th|
|00003b00| 65 20 6c 69 73 74 20 6f | 66 20 66 69 65 6c 64 73 |e list o|f fields|
|00003b10| 20 69 6e 20 74 68 65 20 | 73 74 72 75 63 74 75 72 | in the |structur|
|00003b20| 65 3a 0a 5c 62 65 67 69 | 6e 7b 74 74 64 65 73 63 |e:.\begi|n{ttdesc|
|00003b30| 72 69 70 74 69 6f 6e 7d | 7b 43 6f 6c 6f 72 6d 61 |ription}|{Colorma|
|00003b40| 70 53 69 7a 65 7d 0a 5c | 69 74 65 6d 5b 48 65 69 |pSize}.\|item[Hei|
|00003b50| 67 68 74 5d 20 74 68 65 | 20 68 65 69 67 68 74 2c |ght] the| height,|
|00003b60| 20 69 6e 20 70 69 78 65 | 6c 73 2c 20 6f 66 20 74 | in pixe|ls, of t|
|00003b70| 68 65 20 6d 6f 76 69 65 | 2e 0a 5c 69 74 65 6d 5b |he movie|..\item[|
|00003b80| 57 69 64 74 68 5d 20 74 | 68 65 20 77 69 64 74 68 |Width] t|he width|
|00003b90| 2c 20 69 6e 20 70 69 78 | 65 6c 73 2c 20 6f 66 20 |, in pix|els, of |
|00003ba0| 74 68 65 20 6d 6f 76 69 | 65 2e 20 20 4e 6f 74 65 |the movi|e. Note|
|00003bb0| 20 74 68 61 74 20 64 75 | 65 20 74 6f 20 74 68 65 | that du|e to the|
|00003bc0| 0a 20 20 62 6c 6f 63 6b | 20 6e 61 74 75 72 65 20 |. block| nature |
|00003bd0| 6f 66 20 4d 50 45 47 20 | 65 6e 63 6f 64 69 6e 67 |of MPEG |encoding|
|00003be0| 2c 20 74 68 65 20 68 65 | 69 67 68 74 20 61 6e 64 |, the he|ight and|
|00003bf0| 20 77 69 64 74 68 20 77 | 69 6c 6c 20 61 6c 77 61 | width w|ill alwa|
|00003c00| 79 73 20 62 65 0a 20 20 | 6d 75 6c 74 69 70 6c 65 |ys be. |multiple|
|00003c10| 73 20 6f 66 20 31 36 2e | 0a 5c 69 74 65 6d 5b 44 |s of 16.|.\item[D|
|00003c20| 65 70 74 68 5d 20 74 68 | 65 20 6e 75 6d 62 65 72 |epth] th|e number|
|00003c30| 20 6f 66 20 62 69 74 73 | 20 70 65 72 20 70 69 78 | of bits| per pix|
|00003c40| 65 6c 20 74 68 61 74 20 | 61 72 65 20 61 63 74 75 |el that |are actu|
|00003c50| 61 6c 6c 79 20 72 65 6c | 65 76 61 6e 74 0a 20 20 |ally rel|evant. |
|00003c60| 74 6f 20 74 68 65 20 64 | 69 73 70 6c 61 79 2e 20 |to the d|isplay. |
|00003c70| 20 46 6f 72 20 6d 6f 73 | 74 20 64 69 74 68 65 72 | For mos|t dither|
|00003c80| 69 6e 67 20 6d 65 74 68 | 6f 64 73 2c 20 74 68 69 |ing meth|ods, thi|
|00003c90| 73 20 77 69 6c 6c 20 62 | 65 20 38 20 28 69 2e 65 |s will b|e 8 (i.e|
|00003ca0| 2e 2c 0a 20 20 77 65 20 | 75 73 75 61 6c 6c 79 20 |.,. we |usually |
|00003cb0| 75 73 65 20 61 6e 20 38 | 2d 62 69 74 20 63 6f 6c |use an 8|-bit col|
|00003cc0| 6f 75 72 20 6d 61 70 29 | 3b 20 66 6f 72 20 66 75 |our map)|; for fu|
|00003cd0| 6c 6c 2d 63 6f 6c 6f 75 | 72 20 64 69 74 68 65 72 |ll-colou|r dither|
|00003ce0| 69 6e 67 2c 20 69 74 0a | 20 20 77 69 6c 6c 20 62 |ing, it.| will b|
|00003cf0| 65 20 32 34 2e 0a 5c 69 | 74 65 6d 5b 50 69 78 65 |e 24..\i|tem[Pixe|
|00003d00| 6c 53 69 7a 65 5d 20 74 | 68 65 20 6e 75 6d 62 65 |lSize] t|he numbe|
|00003d10| 72 20 6f 66 20 62 69 74 | 73 20 28 6e 6f 74 20 62 |r of bit|s (not b|
|00003d20| 79 74 65 73 21 29 20 6f | 66 20 73 74 6f 72 61 67 |ytes!) o|f storag|
|00003d30| 65 20 61 6c 6c 6f 63 61 | 74 65 64 0a 20 20 70 65 |e alloca|ted. pe|
|00003d40| 72 20 70 69 78 65 6c 2e | 0a 5c 69 74 65 6d 5b 53 |r pixel.|.\item[S|
|00003d50| 69 7a 65 5d 20 74 68 65 | 20 73 69 7a 65 2c 20 69 |ize] the| size, i|
|00003d60| 6e 20 62 79 74 65 73 2c | 20 6f 66 20 6f 6e 65 20 |n bytes,| of one |
|00003d70| 65 6e 74 69 72 65 20 75 | 6e 65 6e 63 6f 64 65 64 |entire u|nencoded|
|00003d80| 20 66 72 61 6d 65 2e 20 | 20 54 68 69 73 0a 20 20 | frame. | This. |
|00003d90| 69 73 20 73 69 6d 70 6c | 79 20 65 71 75 61 6c 20 |is simpl|y equal |
|00003da0| 74 6f 20 5c 63 6f 64 65 | 7b 48 65 69 67 68 74 2a |to \code|{Height*|
|00003db0| 57 69 64 74 68 2a 50 69 | 78 65 6c 53 69 7a 65 2f |Width*Pi|xelSize/|
|00003dc0| 38 7d 2e 20 20 28 4e 6f | 74 65 3a 0a 20 20 63 75 |8}. (No|te:. cu|
|00003dd0| 72 72 65 6e 74 6c 79 2c | 20 5c 63 6f 64 65 7b 42 |rrently,| \code{B|
|00003de0| 69 74 6d 61 70 50 61 64 | 7d 20 69 73 20 69 67 6e |itmapPad|} is ign|
|00003df0| 6f 72 65 64 20 69 6e 20 | 74 68 65 20 63 61 6c 63 |ored in |the calc|
|00003e00| 75 6c 61 74 69 6f 6e 20 | 6f 66 0a 20 20 5c 63 6f |ulation |of. \co|
|00003e10| 64 65 7b 53 69 7a 65 7d | 2e 29 0a 5c 69 74 65 6d |de{Size}|.).\item|
|00003e20| 5b 42 69 74 6d 61 70 50 | 61 64 5d 20 74 68 65 20 |[BitmapP|ad] the |
|00003e30| 60 60 71 75 61 6e 74 75 | 6d 27 27 20 6f 66 20 61 |``quantu|m'' of a|
|00003e40| 20 73 63 61 6e 20 6c 69 | 6e 65 3b 20 69 2e 65 2e | scan li|ne; i.e.|
|00003e50| 2c 20 65 61 63 68 20 73 | 63 61 6e 20 6c 69 6e 65 |, each s|can line|
|00003e60| 0a 20 20 73 74 61 72 74 | 73 20 6f 6e 20 61 6e 20 |. start|s on an |
|00003e70| 65 76 65 6e 20 69 6e 74 | 65 72 76 61 6c 20 6f 66 |even int|erval of|
|00003e80| 20 74 68 69 73 20 6d 61 | 6e 79 20 62 69 74 73 2e | this ma|ny bits.|
|00003e90| 0a 5c 69 74 65 6d 5b 43 | 6f 6c 6f 72 6d 61 70 53 |.\item[C|olormapS|
|00003ea0| 69 7a 65 5d 20 74 68 65 | 20 6e 75 6d 62 65 72 20 |ize] the| number |
|00003eb0| 6f 66 20 65 6e 74 72 69 | 65 73 20 69 6e 20 74 68 |of entri|es in th|
|00003ec0| 65 20 63 6f 6c 6f 75 72 | 20 6d 61 70 2e 20 20 54 |e colour| map. T|
|00003ed0| 68 69 73 20 69 73 0a 20 | 20 75 73 75 61 6c 6c 79 |his is. | usually|
|00003ee0| 20 31 32 38 2c 20 62 75 | 74 20 66 6f 72 20 6d 6f | 128, bu|t for mo|
|00003ef0| 73 74 20 64 69 74 68 65 | 72 69 6e 67 20 6d 65 74 |st dithe|ring met|
|00003f00| 68 6f 64 73 20 69 74 20 | 63 61 6e 20 62 65 20 69 |hods it |can be i|
|00003f10| 6e 64 69 72 65 63 74 6c | 79 0a 20 20 6d 6f 64 69 |ndirectl|y. modi|
|00003f20| 66 69 65 64 20 62 79 20 | 74 68 65 20 75 73 65 72 |fied by |the user|
|00003f30| 20 6f 66 20 74 68 65 20 | 4c 69 62 72 61 72 79 2e | of the |Library.|
|00003f40| 20 20 49 74 20 69 73 20 | 7a 65 72 6f 20 69 6e 20 | It is |zero in |
|00003f50| 6e 6f 6e 2d 63 6f 6c 6f | 75 72 6d 61 70 70 65 64 |non-colo|urmapped|
|00003f60| 0a 20 20 6d 6f 64 65 73 | 2e 0a 5c 69 74 65 6d 5b |. modes|..\item[|
|00003f70| 43 6f 6c 6f 72 6d 61 70 | 5d 20 74 68 65 20 74 61 |Colormap|] the ta|
|00003f80| 62 6c 65 20 75 73 65 64 | 20 74 6f 20 6d 61 70 20 |ble used| to map |
|00003f90| 70 69 78 65 6c 20 76 61 | 6c 75 65 73 20 74 6f 0a |pixel va|lues to.|
|00003fa0| 20 20 72 65 64 2f 5c 2d | 67 72 65 65 6e 2f 5c 2d | red/\-|green/\-|
|00003fb0| 62 6c 75 65 20 76 61 6c | 75 65 73 20 28 77 68 69 |blue val|ues (whi|
|00003fc0| 63 68 20 61 72 65 20 74 | 68 65 6d 73 65 6c 76 65 |ch are t|hemselve|
|00003fd0| 73 20 73 74 6f 72 65 64 | 20 61 73 20 62 79 74 65 |s stored| as byte|
|00003fe0| 73 20 69 6e 0a 20 20 74 | 68 65 20 5c 63 6f 64 65 |s in. t|he \code|
|00003ff0| 7b 43 6f 6c 6f 72 6d 61 | 70 45 6e 74 72 79 7d 20 |{Colorma|pEntry} |
|00004000| 73 74 72 75 63 74 75 72 | 65 2e 20 20 49 74 20 69 |structur|e. It i|
|00004010| 73 20 5c 63 6f 64 65 7b | 4e 55 4c 4c 7d 20 69 6e |s \code{|NULL} in|
|00004020| 0a 20 20 6e 6f 6e 2d 63 | 6f 6c 6f 75 72 6d 61 70 |. non-c|olourmap|
|00004030| 70 65 64 20 6d 6f 64 65 | 73 2e 0a 5c 65 6e 64 7b |ped mode|s..\end{|
|00004040| 74 74 64 65 73 63 72 69 | 70 74 69 6f 6e 7d 0a 0a |ttdescri|ption}..|
|00004050| 0a 5c 73 75 62 73 65 63 | 74 69 6f 6e 7b 5c 63 6f |.\subsec|tion{\co|
|00004060| 64 65 7b 53 65 74 4d 50 | 45 47 4f 70 74 69 6f 6e |de{SetMP|EGOption|
|00004070| 28 29 7d 7d 0a 5c 70 72 | 6f 74 6f 74 79 70 65 7b |()}}.\pr|ototype{|
|00004080| 76 6f 69 64 20 53 65 74 | 4d 50 45 47 4f 70 74 69 |void Set|MPEGOpti|
|00004090| 6f 6e 20 28 4d 50 45 47 | 4f 70 74 69 6f 6e 45 6e |on (MPEG|OptionEn|
|000040a0| 75 6d 20 4f 70 74 69 6f | 6e 2c 20 69 6e 74 20 56 |um Optio|n, int V|
|000040b0| 61 6c 75 65 29 7d 0a 5c | 6e 6f 69 6e 64 65 6e 74 |alue)}.\|noindent|
|000040c0| 5c 63 6f 64 65 7b 4f 70 | 74 69 6f 6e 7d 20 73 68 |\code{Op|tion} sh|
|000040d0| 6f 75 6c 64 20 62 65 20 | 6f 6e 65 20 6f 66 3a 0a |ould be |one of:.|
|000040e0| 20 20 5c 62 65 67 69 6e | 7b 74 74 64 65 73 63 72 | \begin|{ttdescr|
|000040f0| 69 70 74 69 6f 6e 7d 7b | 4d 50 45 47 5c 5f 43 4d |iption}{|MPEG\_CM|
|00004100| 41 50 5c 5f 49 4e 44 45 | 58 7d 0a 20 20 5c 69 74 |AP\_INDE|X}. \it|
|00004110| 65 6d 5b 4d 50 45 47 5c | 5f 44 49 54 48 45 52 5d |em[MPEG\|_DITHER]|
|00004120| 20 53 65 74 73 20 74 68 | 65 20 64 69 74 68 65 72 | Sets th|e dither|
|00004130| 69 6e 67 20 6d 6f 64 65 | 2c 20 77 68 69 63 68 20 |ing mode|, which |
|00004140| 63 6f 6e 74 72 6f 6c 73 | 20 68 6f 77 20 59 43 72 |controls| how YCr|
|00004150| 43 62 0a 20 20 20 20 76 | 61 6c 75 65 73 20 61 72 |Cb. v|alues ar|
|00004160| 65 20 63 6f 6e 76 65 72 | 74 65 64 20 74 6f 20 52 |e conver|ted to R|
|00004170| 47 42 20 73 70 61 63 65 | 2e 20 20 5c 63 6f 64 65 |GB space|. \code|
|00004180| 7b 56 61 6c 75 65 7d 20 | 73 68 6f 75 6c 64 20 62 |{Value} |should b|
|00004190| 65 20 61 0a 20 20 20 20 | 5c 63 6f 64 65 7b 44 69 |e a. |\code{Di|
|000041a0| 74 68 65 72 45 6e 75 6d | 7d 20 76 61 6c 75 65 2c |therEnum|} value,|
|000041b0| 20 63 61 73 74 20 74 6f | 20 5c 63 6f 64 65 7b 69 | cast to| \code{i|
|000041c0| 6e 74 7d 2e 20 20 44 69 | 74 68 65 72 69 6e 67 20 |nt}. Di|thering |
|000041d0| 6d 6f 64 65 73 20 61 72 | 65 0a 20 20 20 20 65 78 |modes ar|e. ex|
|000041e0| 70 6c 61 69 6e 65 64 20 | 61 62 6f 76 65 2c 20 69 |plained |above, i|
|000041f0| 6e 20 73 65 63 74 69 6f | 6e 7e 5c 72 65 66 7b 73 |n sectio|n~\ref{s|
|00004200| 65 63 3a 64 69 74 68 65 | 72 69 6e 67 7d 2e 0a 0a |ec:dithe|ring}...|
|00004210| 20 20 5c 69 74 65 6d 5b | 4d 50 45 47 5c 5f 4c 55 | \item[|MPEG\_LU|
|00004220| 4d 5c 5f 52 41 4e 47 45 | 5d 0a 20 20 5c 69 74 65 |M\_RANGE|]. \ite|
|00004230| 6d 5b 4d 50 45 47 5c 5f | 43 52 5c 5f 52 41 4e 47 |m[MPEG\_|CR\_RANG|
|00004240| 45 5d 0a 20 20 5c 69 74 | 65 6d 5b 4d 50 45 47 5c |E]. \it|em[MPEG\|
|00004250| 5f 43 42 5c 5f 52 41 4e | 47 45 5d 20 54 68 65 73 |_CB\_RAN|GE] Thes|
|00004260| 65 20 73 65 74 20 74 68 | 65 20 72 61 6e 67 65 73 |e set th|e ranges|
|00004270| 20 6f 66 20 6c 75 6d 69 | 6e 61 6e 63 65 20 61 6e | of lumi|nance an|
|00004280| 64 0a 20 20 20 20 63 68 | 72 6f 6d 61 74 69 63 69 |d. ch|romatici|
|00004290| 74 79 20 76 61 6c 75 65 | 73 2e 20 20 54 68 65 20 |ty value|s. The |
|000042a0| 64 65 66 61 75 6c 74 73 | 20 61 72 65 20 38 2c 20 |defaults| are 8, |
|000042b0| 34 2c 20 61 6e 64 20 34 | 2e 20 20 28 49 20 64 6f |4, and 4|. (I do|
|000042c0| 0a 20 20 20 20 6e 6f 74 | 20 75 6e 64 65 72 73 74 |. not| underst|
|000042d0| 61 6e 64 20 74 68 65 20 | 65 66 66 65 63 74 73 20 |and the |effects |
|000042e0| 6f 66 20 63 68 61 6e 67 | 69 6e 67 20 74 68 65 73 |of chang|ing thes|
|000042f0| 65 3b 20 6d 79 20 65 78 | 70 65 72 69 6d 65 6e 74 |e; my ex|periment|
|00004300| 73 0a 20 20 20 20 69 6e | 64 69 63 61 74 65 20 74 |s. in|dicate t|
|00004310| 68 61 74 20 64 6f 69 6e | 67 20 73 6f 20 67 61 72 |hat doin|g so gar|
|00004320| 62 6c 65 73 20 70 65 72 | 66 65 63 74 6c 79 20 67 |bles per|fectly g|
|00004330| 6f 6f 64 20 63 6f 6c 6f | 75 72 20 6d 61 70 73 2e |ood colo|ur maps.|
|00004340| 29 0a 0a 25 20 20 5c 69 | 74 65 6d 5b 4d 50 45 47 |)..% \i|tem[MPEG|
|00004350| 5c 5f 43 4d 41 50 5c 5f | 49 4e 44 45 58 5d 20 54 |\_CMAP\_|INDEX] T|
|00004360| 68 69 73 20 61 6c 6c 6f | 77 73 20 79 6f 75 20 74 |his allo|ws you t|
|00004370| 6f 20 73 65 74 20 74 68 | 65 20 6d 61 70 70 69 6e |o set th|e mappin|
|00004380| 67 20 6f 66 0a 25 20 20 | 20 20 60 60 69 64 65 61 |g of.% | ``idea|
|00004390| 6c 27 27 20 70 69 78 65 | 6c 20 76 61 6c 75 65 73 |l'' pixe|l values|
|000043a0| 20 28 69 2e 65 2e 2c 20 | 69 6e 64 65 63 65 73 20 | (i.e., |indeces |
|000043b0| 69 6e 74 6f 20 74 68 65 | 20 63 6f 6c 6f 75 72 20 |into the| colour |
|000043c0| 6d 61 70 20 72 65 74 75 | 72 6e 65 64 0a 25 20 20 |map retu|rned.% |
|000043d0| 20 20 62 79 20 5c 63 6f | 64 65 7b 4f 70 65 6e 4d | by \co|de{OpenM|
|000043e0| 50 45 47 28 29 7d 20 69 | 6e 20 74 68 65 20 5c 63 |PEG()} i|n the \c|
|000043f0| 6f 64 65 7b 43 6f 6c 6f | 72 5c 2d 6d 61 70 7d 20 |ode{Colo|r\-map} |
|00004400| 66 69 65 6c 64 20 6f 66 | 20 74 68 65 0a 25 20 20 |field of| the.% |
|00004410| 20 20 5c 63 6f 64 65 7b | 49 6d 61 67 65 44 65 73 | \code{|ImageDes|
|00004420| 63 7d 20 73 74 72 75 63 | 74 75 72 65 29 20 74 6f |c} struc|ture) to|
|00004430| 20 60 60 72 65 61 6c 2d | 77 6f 72 6c 64 27 27 20 | ``real-|world'' |
|00004440| 70 69 78 65 6c 20 76 61 | 6c 75 65 73 2c 20 6f 72 |pixel va|lues, or|
|00004450| 0a 25 20 20 20 20 69 6e | 64 65 63 65 73 20 69 6e |.% in|deces in|
|00004460| 74 6f 20 74 68 65 20 73 | 79 73 74 65 6d 20 63 6f |to the s|ystem co|
|00004470| 6c 6f 75 72 20 6d 61 70 | 20 74 68 61 74 20 79 6f |lour map| that yo|
|00004480| 75 20 77 65 72 65 20 61 | 62 6c 65 20 74 6f 20 61 |u were a|ble to a|
|00004490| 6c 6c 6f 63 61 74 65 2e | 0a 25 20 20 20 20 53 65 |llocate.|.% Se|
|000044a0| 65 20 73 65 63 74 69 6f | 6e 7e 5c 72 65 66 7b 73 |e sectio|n~\ref{s|
|000044b0| 65 63 3a 63 6f 6c 6f 75 | 72 5f 6d 61 70 73 7d 20 |ec:colou|r_maps} |
|000044c0| 66 6f 72 20 6d 6f 72 65 | 20 69 6e 66 6f 72 6d 61 |for more| informa|
|000044d0| 74 69 6f 6e 20 6f 6e 0a | 25 20 20 20 20 63 6f 6c |tion on.|% col|
|000044e0| 6f 75 72 2d 6d 61 70 70 | 65 64 20 6d 6f 64 65 73 |our-mapp|ed modes|
|000044f0| 2e 20 20 54 68 65 20 5c | 63 6f 64 65 7b 56 61 6c |. The \|code{Val|
|00004500| 75 65 7d 20 70 61 73 73 | 65 64 20 74 6f 0a 25 20 |ue} pass|ed to.% |
|00004510| 20 20 20 5c 63 6f 64 65 | 7b 53 65 74 4d 50 45 47 | \code|{SetMPEG|
|00004520| 4f 70 74 69 6f 6e 28 29 | 7d 20 73 68 6f 75 6c 64 |Option()|} should|
|00004530| 20 62 65 20 61 20 70 6f | 69 6e 74 65 72 20 74 6f | be a po|inter to|
|00004540| 20 61 6e 20 61 72 72 61 | 79 20 6f 66 0a 25 20 20 | an arra|y of.% |
|00004550| 20 20 5c 63 6f 64 65 7b | 75 6e 73 69 67 6e 65 64 | \code{|unsigned|
|00004560| 20 63 68 61 72 7d 20 77 | 69 74 68 20 5c 63 6f 64 | char} w|ith \cod|
|00004570| 65 7b 43 6f 6c 6f 72 6d | 61 70 53 69 7a 65 7d 20 |e{Colorm|apSize} |
|00004580| 65 6e 74 72 69 65 73 20 | 28 63 61 73 74 20 74 6f |entries |(cast to|
|00004590| 0a 25 20 20 20 20 5c 63 | 6f 64 65 7b 69 6e 74 7d |.% \c|ode{int}|
|000045a0| 2c 20 6f 66 20 63 6f 75 | 72 73 65 29 2e 20 20 54 |, of cou|rse). T|
|000045b0| 68 65 20 63 6f 6e 74 65 | 6e 74 73 20 6f 66 20 74 |he conte|nts of t|
|000045c0| 68 69 73 20 61 72 72 61 | 79 20 77 69 6c 6c 20 62 |his arra|y will b|
|000045d0| 65 20 63 6f 70 69 65 64 | 0a 25 20 20 20 20 69 6e |e copied|.% in|
|000045e0| 74 6f 20 61 20 70 72 69 | 76 61 74 65 20 4c 69 62 |to a pri|vate Lib|
|000045f0| 72 61 72 79 20 61 72 72 | 61 79 2c 20 73 6f 20 79 |rary arr|ay, so y|
|00004600| 6f 75 20 64 6f 6e 27 74 | 20 6e 65 65 64 20 74 6f |ou don't| need to|
|00004610| 20 77 6f 72 72 79 20 61 | 62 6f 75 74 20 0a 25 20 | worry a|bout .% |
|00004620| 20 20 20 6b 65 65 70 69 | 6e 67 20 69 74 20 61 72 | keepi|ng it ar|
|00004630| 6f 75 6e 64 20 61 66 74 | 65 72 20 63 61 6c 6c 69 |ound aft|er calli|
|00004640| 6e 67 20 5c 63 6f 64 65 | 7b 53 65 74 4d 50 45 47 |ng \code|{SetMPEG|
|00004650| 4f 70 74 69 6f 6e 28 29 | 7d 2e 0a 0a 20 20 5c 65 |Option()|}... \e|
|00004660| 6e 64 7b 74 74 64 65 73 | 63 72 69 70 74 69 6f 6e |nd{ttdes|cription|
|00004670| 7d 0a 0a 5c 62 65 67 69 | 6e 7b 4e 6f 74 65 73 7d |}..\begi|n{Notes}|
|00004680| 0a 20 20 5c 63 6f 64 65 | 7b 53 65 74 4d 50 45 47 |. \code|{SetMPEG|
|00004690| 4f 70 74 69 6f 6e 28 29 | 7d 20 61 6c 6c 6f 77 73 |Option()|} allows|
|000046a0| 20 79 6f 75 20 74 6f 20 | 73 65 74 20 61 20 76 61 | you to |set a va|
|000046b0| 72 69 65 74 79 20 6f 66 | 20 6f 70 74 69 6f 6e 73 |riety of| options|
|000046c0| 20 72 65 6c 61 74 65 64 | 0a 20 20 74 6f 20 4d 50 | related|. to MP|
|000046d0| 45 47 20 64 65 63 6f 64 | 69 6e 67 2e 20 20 54 68 |EG decod|ing. Th|
|000046e0| 65 20 70 6f 73 73 69 62 | 6c 65 20 76 61 6c 75 65 |e possib|le value|
|000046f0| 73 20 66 6f 72 20 5c 63 | 6f 64 65 7b 4f 70 74 69 |s for \c|ode{Opti|
|00004700| 6f 6e 7d 20 61 72 65 20 | 64 65 73 63 72 69 62 65 |on} are |describe|
|00004710| 64 0a 20 20 61 62 6f 76 | 65 3b 20 74 68 65 20 70 |d. abov|e; the p|
|00004720| 6f 73 73 69 62 6c 65 20 | 76 61 6c 75 65 73 20 66 |ossible |values f|
|00004730| 6f 72 20 5c 63 6f 64 65 | 7b 56 61 6c 75 65 7d 20 |or \code|{Value} |
|00004740| 76 61 6c 75 65 20 61 72 | 65 20 64 65 70 65 6e 64 |value ar|e depend|
|00004750| 65 6e 74 20 6f 6e 0a 20 | 20 77 68 61 74 20 5c 63 |ent on. | what \c|
|00004760| 6f 64 65 7b 4f 70 74 69 | 6f 6e 7d 20 79 6f 75 20 |ode{Opti|on} you |
|00004770| 61 72 65 20 73 65 74 74 | 69 6e 67 2e 20 20 57 68 |are sett|ing. Wh|
|00004780| 61 74 65 76 65 72 20 5c | 63 6f 64 65 7b 56 61 6c |atever \|code{Val|
|00004790| 75 65 7d 20 69 73 2c 20 | 69 74 0a 20 20 73 68 6f |ue} is, |it. sho|
|000047a0| 75 6c 64 20 6f 66 20 63 | 6f 75 72 73 65 20 62 65 |uld of c|ourse be|
|000047b0| 20 63 61 73 74 20 74 6f | 20 61 6e 20 5c 63 6f 64 | cast to| an \cod|
|000047c0| 65 7b 69 6e 74 7d 2e 0a | 5c 65 6e 64 7b 4e 6f 74 |e{int}..|\end{Not|
|000047d0| 65 73 7d 0a 0a 0a 5c 73 | 75 62 73 65 63 74 69 6f |es}...\s|ubsectio|
|000047e0| 6e 7b 5c 63 6f 64 65 7b | 4f 70 65 6e 4d 50 45 47 |n{\code{|OpenMPEG|
|000047f0| 28 29 7d 7d 0a 5c 70 72 | 6f 74 6f 74 79 70 65 7b |()}}.\pr|ototype{|
|00004800| 42 6f 6f 6c 65 61 6e 20 | 4f 70 65 6e 4d 50 45 47 |Boolean |OpenMPEG|
|00004810| 20 28 46 49 4c 45 20 2a | 4d 50 45 47 66 69 6c 65 | (FILE *|MPEGfile|
|00004820| 2c 20 49 6d 61 67 65 44 | 65 73 63 20 2a 49 6d 61 |, ImageD|esc *Ima|
|00004830| 67 65 29 7d 0a 5c 62 65 | 67 69 6e 7b 41 72 67 75 |ge)}.\be|gin{Argu|
|00004840| 6d 65 6e 74 73 7d 7b 4d | 50 45 47 66 69 6c 65 7d |ments}{M|PEGfile}|
|00004850| 0a 5c 69 74 65 6d 5b 4d | 50 45 47 66 69 6c 65 5d |.\item[M|PEGfile]|
|00004860| 20 41 20 66 69 6c 65 20 | 74 68 61 74 20 69 73 20 | A file |that is |
|00004870| 61 6c 72 65 61 64 79 20 | 6f 70 65 6e 20 66 6f 72 |already |open for|
|00004880| 20 72 65 61 64 69 6e 67 | 2c 20 70 6f 73 69 74 69 | reading|, positi|
|00004890| 6f 6e 65 64 20 61 74 0a | 20 20 74 68 65 20 62 65 |oned at.| the be|
|000048a0| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 61 6e 20 4d 50 |ginning |of an MP|
|000048b0| 45 47 20 73 74 72 65 61 | 6d 2e 0a 5c 69 74 65 6d |EG strea|m..\item|
|000048c0| 5b 49 6d 61 67 65 5d 20 | 50 6f 69 6e 74 65 72 20 |[Image] |Pointer |
|000048d0| 74 6f 20 61 20 75 73 65 | 72 2d 64 65 63 6c 61 72 |to a use|r-declar|
|000048e0| 65 64 20 5c 63 6f 64 65 | 7b 49 6d 61 67 65 44 65 |ed \code|{ImageDe|
|000048f0| 73 63 7d 20 73 74 72 75 | 63 74 75 72 65 2e 0a 20 |sc} stru|cture.. |
|00004900| 20 59 6f 75 20 73 68 6f | 75 6c 64 6e 27 74 20 63 | You sho|uldn't c|
|00004910| 68 61 6e 67 65 20 61 6e | 79 20 6f 66 20 74 68 65 |hange an|y of the|
|00004920| 20 66 69 65 6c 64 73 20 | 69 6e 20 5c 63 6f 64 65 | fields |in \code|
|00004930| 7b 2a 49 6d 61 67 65 7d | 20 79 6f 75 72 73 65 6c |{*Image}| yoursel|
|00004940| 66 2c 0a 20 20 65 69 74 | 68 65 72 20 62 65 66 6f |f,. eit|her befo|
|00004950| 72 65 20 6f 72 20 61 66 | 74 65 72 20 63 61 6c 6c |re or af|ter call|
|00004960| 69 6e 67 20 5c 63 6f 64 | 65 7b 4f 70 65 6e 4d 50 |ing \cod|e{OpenMP|
|00004970| 45 47 28 29 7d 3b 20 75 | 73 65 0a 20 20 5c 63 6f |EG()}; u|se. \co|
|00004980| 64 65 7b 53 65 74 4d 50 | 45 47 4f 70 74 69 6f 6e |de{SetMP|EGOption|
|00004990| 28 29 7d 20 69 6e 73 74 | 65 61 64 2e 0a 5c 65 6e |()} inst|ead..\en|
|000049a0| 64 7b 41 72 67 75 6d 65 | 6e 74 73 7d 0a 5c 62 65 |d{Argume|nts}.\be|
|000049b0| 67 69 6e 7b 4e 6f 74 65 | 73 7d 0a 20 20 5c 63 6f |gin{Note|s}. \co|
|000049c0| 64 65 7b 4f 70 65 6e 4d | 50 45 47 28 29 7d 20 70 |de{OpenM|PEG()} p|
|000049d0| 72 65 70 61 72 65 73 20 | 61 6e 20 4d 50 45 47 20 |repares |an MPEG |
|000049e0| 73 74 72 65 61 6d 20 66 | 6f 72 20 64 65 63 6f 64 |stream f|or decod|
|000049f0| 69 6e 67 2e 20 20 49 74 | 0a 20 20 69 6e 69 74 69 |ing. It|. initi|
|00004a00| 61 6c 69 7a 65 73 20 69 | 6e 74 65 72 6e 61 6c 20 |alizes i|nternal |
|00004a10| 64 61 74 61 20 73 74 72 | 75 63 74 75 72 65 73 20 |data str|uctures |
|00004a20| 66 6f 72 20 64 65 63 6f | 64 69 6e 67 20 61 6e 64 |for deco|ding and|
|00004a30| 20 64 69 74 68 65 72 69 | 6e 67 0a 20 20 61 6e 64 | ditheri|ng. and|
|00004a40| 2d 2d 2d 69 66 20 61 70 | 70 6c 69 63 61 62 6c 65 |---if ap|plicable|
|00004a50| 2d 2d 2d 63 72 65 61 74 | 65 73 20 61 20 63 6f 6c |---creat|es a col|
|00004a60| 6f 75 72 20 6d 61 70 2e | 20 20 41 66 74 65 72 20 |our map.| After |
|00004a70| 63 61 6c 6c 69 6e 67 0a | 20 20 5c 63 6f 64 65 7b |calling.| \code{|
|00004a80| 4f 70 65 6e 4d 50 45 47 | 28 29 7d 2c 20 74 68 65 |OpenMPEG|()}, the|
|00004a90| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 66 69 65 6c 64 | followi|ng field|
|00004aa0| 73 20 69 6e 20 5c 63 6f | 64 65 7b 2a 49 6d 61 67 |s in \co|de{*Imag|
|00004ab0| 65 7d 20 77 69 6c 6c 20 | 62 65 0a 20 20 73 65 74 |e} will |be. set|
|00004ac0| 3a 20 5c 63 6f 64 65 7b | 48 65 69 67 68 74 7d 2c |: \code{|Height},|
|00004ad0| 20 5c 63 6f 64 65 7b 57 | 69 64 74 68 7d 2c 20 5c | \code{W|idth}, \|
|00004ae0| 63 6f 64 65 7b 44 65 70 | 74 68 7d 2c 20 5c 63 6f |code{Dep|th}, \co|
|00004af0| 64 65 7b 50 69 78 65 6c | 53 69 7a 65 7d 2c 0a 20 |de{Pixel|Size},. |
|00004b00| 20 5c 63 6f 64 65 7b 53 | 69 7a 65 7d 2c 20 5c 63 | \code{S|ize}, \c|
|00004b10| 6f 64 65 7b 42 69 74 6d | 61 70 50 61 64 7d 2c 20 |ode{Bitm|apPad}, |
|00004b20| 5c 63 6f 64 65 7b 43 6f | 6c 6f 72 6d 61 70 53 69 |\code{Co|lormapSi|
|00004b30| 7a 65 7d 2c 20 61 6e 64 | 0a 20 20 5c 63 6f 64 65 |ze}, and|. \code|
|00004b40| 7b 43 6f 6c 6f 72 6d 61 | 70 7d 2e 0a 5c 65 6e 64 |{Colorma|p}..\end|
|00004b50| 7b 4e 6f 74 65 73 7d 0a | 0a 0a 5c 73 75 62 73 65 |{Notes}.|..\subse|
|00004b60| 63 74 69 6f 6e 7b 5c 63 | 6f 64 65 7b 47 65 74 4d |ction{\c|ode{GetM|
|00004b70| 50 45 47 46 72 61 6d 65 | 28 29 7d 7d 0a 5c 70 72 |PEGFrame|()}}.\pr|
|00004b80| 6f 74 6f 74 79 70 65 7b | 42 6f 6f 6c 65 61 6e 20 |ototype{|Boolean |
|00004b90| 47 65 74 4d 50 45 47 46 | 72 61 6d 65 20 28 63 68 |GetMPEGF|rame (ch|
|00004ba0| 61 72 20 2a 46 72 61 6d | 65 29 7d 0a 5c 62 65 67 |ar *Fram|e)}.\beg|
|00004bb0| 69 6e 7b 41 72 67 75 6d | 65 6e 74 73 7d 7b 46 72 |in{Argum|ents}{Fr|
|00004bc0| 61 6d 65 7d 0a 5c 69 74 | 65 6d 5b 46 72 61 6d 65 |ame}.\it|em[Frame|
|00004bd0| 5d 20 50 6f 69 6e 74 65 | 72 20 74 6f 20 61 20 75 |] Pointe|r to a u|
|00004be0| 73 65 72 2d 61 6c 6c 6f | 63 61 74 65 64 20 63 68 |ser-allo|cated ch|
|00004bf0| 75 6e 6b 20 6f 66 20 6d | 65 6d 6f 72 79 2e 20 20 |unk of m|emory. |
|00004c00| 4d 75 73 74 20 68 61 76 | 65 0a 20 20 65 6e 6f 75 |Must hav|e. enou|
|00004c10| 67 68 20 72 6f 6f 6d 20 | 66 6f 72 20 74 68 65 20 |gh room |for the |
|00004c20| 64 65 63 6f 64 65 64 20 | 69 6d 61 67 65 2c 20 77 |decoded |image, w|
|00004c30| 68 69 63 68 20 63 61 6e | 20 62 65 20 64 65 74 65 |hich can| be dete|
|00004c40| 72 6d 69 6e 65 64 20 66 | 72 6f 6d 20 74 68 65 0a |rmined f|rom the.|
|00004c50| 20 20 5c 63 6f 64 65 7b | 53 69 7a 65 7d 20 66 69 | \code{|Size} fi|
|00004c60| 65 6c 64 20 6f 66 20 5c | 63 6f 64 65 7b 49 6d 61 |eld of \|code{Ima|
|00004c70| 67 65 44 65 73 63 7d 2e | 0a 5c 65 6e 64 7b 41 72 |geDesc}.|.\end{Ar|
|00004c80| 67 75 6d 65 6e 74 73 7d | 0a 5c 62 65 67 69 6e 7b |guments}|.\begin{|
|00004c90| 4e 6f 74 65 73 7d 0a 20 | 20 44 65 63 6f 64 65 73 |Notes}. | Decodes|
|00004ca0| 20 74 68 65 20 6e 65 78 | 74 20 66 72 61 6d 65 20 | the nex|t frame |
|00004cb0| 66 72 6f 6d 20 74 68 65 | 20 6d 6f 76 69 65 2e 20 |from the| movie. |
|00004cc0| 20 52 65 74 75 72 6e 73 | 20 5c 63 6f 64 65 7b 54 | Returns| \code{T|
|00004cd0| 52 55 45 7d 20 69 66 20 | 74 68 65 72 65 0a 20 20 |RUE} if |there. |
|00004ce0| 61 72 65 20 61 6e 79 20 | 66 72 61 6d 65 73 20 6c |are any |frames l|
|00004cf0| 65 66 74 20 74 6f 20 64 | 65 63 6f 64 65 20 69 6e |eft to d|ecode in|
|00004d00| 20 74 68 65 20 6d 6f 76 | 69 65 2c 20 6f 72 20 5c | the mov|ie, or \|
|00004d10| 63 6f 64 65 7b 46 41 4c | 53 45 7d 20 69 66 20 74 |code{FAL|SE} if t|
|00004d20| 68 65 0a 20 20 64 65 63 | 6f 64 65 64 20 66 72 61 |he. dec|oded fra|
|00004d30| 6d 65 20 69 73 20 74 68 | 65 20 6c 61 73 74 20 66 |me is th|e last f|
|00004d40| 72 61 6d 65 20 69 6e 20 | 74 68 65 20 6d 6f 76 69 |rame in |the movi|
|00004d50| 65 2e 20 20 54 68 61 74 | 20 69 73 2c 20 66 6f 72 |e. That| is, for|
|00004d60| 20 61 20 6d 6f 76 69 65 | 0a 20 20 77 69 74 68 20 | a movie|. with |
|00004d70| 24 4e 24 20 66 72 61 6d | 65 73 20 5c 63 6f 64 65 |$N$ fram|es \code|
|00004d80| 7b 47 65 74 4d 50 45 47 | 46 72 61 6d 65 28 29 7d |{GetMPEG|Frame()}|
|00004d90| 20 77 69 6c 6c 20 72 65 | 74 75 72 6e 20 5c 63 6f | will re|turn \co|
|00004da0| 64 65 7b 54 52 55 45 7d | 20 24 4e 2d 31 24 0a 20 |de{TRUE}| $N-1$. |
|00004db0| 20 74 69 6d 65 73 2c 20 | 61 6e 64 20 74 68 65 6e | times, |and then|
|00004dc0| 20 74 68 65 20 63 61 6c | 6c 20 74 6f 20 64 65 63 | the cal|l to dec|
|00004dd0| 6f 64 65 20 74 68 65 20 | 6c 61 73 74 20 66 72 61 |ode the |last fra|
|00004de0| 6d 65 20 77 69 6c 6c 20 | 72 65 74 75 72 6e 0a 20 |me will |return. |
|00004df0| 20 5c 63 6f 64 65 7b 46 | 41 4c 53 45 7d 2e 20 20 | \code{F|ALSE}. |
|00004e00| 41 66 74 65 72 20 74 68 | 61 74 2c 20 74 68 65 20 |After th|at, the |
|00004e10| 62 65 68 61 76 69 6f 75 | 72 20 6f 66 20 5c 63 6f |behaviou|r of \co|
|00004e20| 64 65 7b 47 65 74 4d 50 | 45 47 46 72 61 6d 65 28 |de{GetMP|EGFrame(|
|00004e30| 29 7d 20 69 73 0a 20 20 | 75 6e 64 65 66 69 6e 65 |)} is. |undefine|
|00004e40| 64 20 28 75 6e 6c 65 73 | 73 20 79 6f 75 20 63 61 |d (unles|s you ca|
|00004e50| 6c 6c 20 5c 63 6f 64 65 | 7b 52 65 77 69 6e 64 4d |ll \code|{RewindM|
|00004e60| 50 45 47 28 29 7d 2e 29 | 0a 5c 65 6e 64 7b 4e 6f |PEG()}.)|.\end{No|
|00004e70| 74 65 73 7d 0a 0a 0a 5c | 73 75 62 73 65 63 74 69 |tes}...\|subsecti|
|00004e80| 6f 6e 7b 5c 63 6f 64 65 | 7b 52 65 77 69 6e 64 4d |on{\code|{RewindM|
|00004e90| 50 45 47 28 29 7d 7d 0a | 5c 70 72 6f 74 6f 74 79 |PEG()}}.|\prototy|
|00004ea0| 70 65 7b 76 6f 69 64 20 | 52 65 77 69 6e 64 4d 50 |pe{void |RewindMP|
|00004eb0| 45 47 20 28 46 49 4c 45 | 20 2a 4d 50 45 47 66 69 |EG (FILE| *MPEGfi|
|00004ec0| 6c 65 2c 20 49 6d 61 67 | 65 44 65 73 63 20 2a 49 |le, Imag|eDesc *I|
|00004ed0| 6d 61 67 65 29 7d 0a 5c | 62 65 67 69 6e 7b 41 72 |mage)}.\|begin{Ar|
|00004ee0| 67 75 6d 65 6e 74 73 7d | 7b 4d 50 45 47 66 69 6c |guments}|{MPEGfil|
|00004ef0| 65 7d 0a 5c 69 74 65 6d | 5b 4d 50 45 47 66 69 6c |e}.\item|[MPEGfil|
|00004f00| 65 5d 20 54 68 65 20 6f | 70 65 6e 2c 20 72 65 61 |e] The o|pen, rea|
|00004f10| 64 61 62 6c 65 20 73 74 | 72 65 61 6d 20 70 6f 69 |dable st|ream poi|
|00004f20| 6e 74 65 72 20 74 68 61 | 74 20 77 61 73 20 61 6c |nter tha|t was al|
|00004f30| 73 6f 20 70 61 73 73 65 | 64 0a 20 20 74 6f 20 5c |so passe|d. to \|
|00004f40| 63 6f 64 65 7b 4f 70 65 | 6e 4d 50 45 47 28 29 7d |code{Ope|nMPEG()}|
|00004f50| 2e 0a 5c 69 74 65 6d 5b | 49 6d 61 67 65 5d 20 54 |..\item[|Image] T|
|00004f60| 68 65 20 69 6d 61 67 65 | 20 64 65 73 63 72 69 70 |he image| descrip|
|00004f70| 74 6f 72 20 74 68 61 74 | 20 77 61 73 20 70 61 73 |tor that| was pas|
|00004f80| 73 65 64 20 74 6f 20 61 | 6e 64 20 66 69 6c 6c 65 |sed to a|nd fille|
|00004f90| 64 20 69 6e 20 62 79 0a | 20 20 5c 63 6f 64 65 7b |d in by.| \code{|
|00004fa0| 4f 70 65 6e 4d 50 45 47 | 28 29 7d 2e 0a 5c 65 6e |OpenMPEG|()}..\en|
|00004fb0| 64 7b 41 72 67 75 6d 65 | 6e 74 73 7d 0a 5c 62 65 |d{Argume|nts}.\be|
|00004fc0| 67 69 6e 7b 4e 6f 74 65 | 73 7d 0a 20 20 52 65 70 |gin{Note|s}. Rep|
|00004fd0| 6f 73 69 74 69 6f 6e 73 | 20 5c 63 6f 64 65 7b 4d |ositions| \code{M|
|00004fe0| 50 45 47 66 69 6c 65 7d | 27 73 20 66 69 6c 65 2d |PEGfile}|'s file-|
|00004ff0| 6f 66 66 73 65 74 20 70 | 6f 69 6e 74 65 72 20 74 |offset p|ointer t|
|00005000| 6f 20 70 6f 69 6e 74 20 | 74 6f 20 74 68 65 0a 20 |o point |to the. |
|00005010| 20 62 65 67 69 6e 6e 69 | 6e 67 20 6f 66 20 74 68 | beginni|ng of th|
|00005020| 65 20 73 74 72 65 61 6d | 2c 20 61 6e 64 20 72 65 |e stream|, and re|
|00005030| 69 6e 69 74 69 61 6c 69 | 7a 65 73 20 69 6e 74 65 |initiali|zes inte|
|00005040| 72 6e 61 6c 20 4d 50 45 | 47 20 4c 69 62 72 61 72 |rnal MPE|G Librar|
|00005050| 79 0a 20 20 73 74 72 75 | 63 74 75 72 65 73 20 74 |y. stru|ctures t|
|00005060| 6f 20 70 72 65 70 61 72 | 65 20 72 65 61 64 69 6e |o prepar|e readin|
|00005070| 67 20 74 68 65 20 4d 50 | 45 47 20 61 67 61 69 6e |g the MP|EG again|
|00005080| 2e 20 20 54 68 65 20 66 | 69 72 73 74 20 63 61 6c |. The f|irst cal|
|00005090| 6c 20 74 6f 0a 20 20 5c | 63 6f 64 65 7b 47 65 74 |l to. \|code{Get|
|000050a0| 4d 50 45 47 46 72 61 6d | 65 28 29 7d 20 61 66 74 |MPEGFram|e()} aft|
|000050b0| 65 72 20 63 61 6c 6c 69 | 6e 67 20 5c 63 6f 64 65 |er calli|ng \code|
|000050c0| 7b 52 65 77 69 6e 64 4d | 50 45 47 28 29 7d 20 77 |{RewindM|PEG()} w|
|000050d0| 69 6c 6c 20 72 65 74 75 | 72 6e 0a 20 20 74 68 65 |ill retu|rn. the|
|000050e0| 20 66 69 72 73 74 20 66 | 72 61 6d 65 20 6f 66 20 | first f|rame of |
|000050f0| 74 68 65 20 6d 6f 76 69 | 65 2c 20 61 73 20 74 68 |the movi|e, as th|
|00005100| 6f 75 67 68 20 5c 63 6f | 64 65 7b 4f 70 65 6e 4d |ough \co|de{OpenM|
|00005110| 50 45 47 28 29 7d 20 68 | 61 64 20 6a 75 73 74 0a |PEG()} h|ad just.|
|00005120| 20 20 62 65 65 6e 20 63 | 61 6c 6c 65 64 2e 0a 5c | been c|alled..\|
|00005130| 65 6e 64 7b 4e 6f 74 65 | 73 7d 0a 0a 5c 73 65 63 |end{Note|s}..\sec|
|00005140| 74 69 6f 6e 2a 7b 41 63 | 6b 6e 6f 77 6c 65 64 67 |tion*{Ac|knowledg|
|00005150| 65 6d 65 6e 74 73 7d 0a | 4d 6f 73 74 20 6f 66 20 |ements}.|Most of |
|00005160| 74 68 65 20 63 72 65 64 | 69 74 20 66 6f 72 20 74 |the cred|it for t|
|00005170| 68 69 73 20 70 61 63 6b | 61 67 65 20 73 68 6f 75 |his pack|age shou|
|00005180| 6c 64 20 67 6f 20 74 6f | 20 74 68 65 20 61 75 74 |ld go to| the aut|
|00005190| 68 6f 72 73 20 6f 66 0a | 5c 63 6f 64 65 7b 6d 70 |hors of.|\code{mp|
|000051a0| 65 67 5c 5f 70 6c 61 79 | 7d 3b 20 61 6c 6c 20 49 |eg\_play|}; all I|
|000051b0| 20 63 61 6e 20 72 65 61 | 6c 6c 79 20 74 61 6b 65 | can rea|lly take|
|000051c0| 20 63 72 65 64 69 74 20 | 66 6f 72 20 69 73 20 73 | credit |for is s|
|000051d0| 68 75 66 66 6c 69 6e 67 | 20 63 6f 64 65 0a 61 72 |huffling| code.ar|
|000051e0| 6f 75 6e 64 20 61 6e 64 | 20 63 6f 6d 69 6e 67 20 |ound and| coming |
|000051f0| 75 70 20 77 69 74 68 20 | 61 20 72 65 61 73 6f 6e |up with |a reason|
|00005200| 61 62 6c 79 20 69 6e 74 | 65 6c 6c 69 67 65 6e 74 |ably int|elligent|
|00005210| 20 69 6e 74 65 72 66 61 | 63 65 20 74 6f 20 74 68 | interfa|ce to th|
|00005220| 65 0a 64 65 63 6f 64 69 | 6e 67 20 65 6e 67 69 6e |e.decodi|ng engin|
|00005230| 65 20 74 68 61 74 20 64 | 6f 65 73 20 74 68 65 20 |e that d|oes the |
|00005240| 72 65 61 6c 20 77 6f 72 | 6b 2e 20 20 0a 0a 54 68 |real wor|k. ..Th|
|00005250| 61 6e 6b 73 20 74 6f 20 | 4d 61 67 6e 75 73 20 48 |anks to |Magnus H|
|00005260| 65 6c 64 65 73 74 61 74 | 20 66 6f 72 20 63 6f 6e |eldestat| for con|
|00005270| 74 72 69 62 75 74 69 6e | 67 20 61 20 73 70 65 64 |tributin|g a sped|
|00005280| 2d 75 70 20 76 65 72 73 | 69 6f 6e 20 6f 66 0a 32 |-up vers|ion of.2|
|00005290| 34 62 69 74 2e 63 2c 20 | 72 65 73 75 6c 74 69 6e |4bit.c, |resultin|
|000052a0| 67 20 69 6e 20 66 61 73 | 74 65 72 20 64 65 63 6f |g in fas|ter deco|
|000052b0| 64 69 6e 67 2f 64 69 74 | 68 65 72 69 6e 67 20 6f |ding/dit|hering o|
|000052c0| 66 20 66 75 6c 6c 2d 63 | 6f 6c 6f 75 72 20 69 6d |f full-c|olour im|
|000052d0| 61 67 65 73 2e 0a 0a 5c | 62 65 67 69 6e 7b 74 68 |ages...\|begin{th|
|000052e0| 65 62 69 62 6c 69 6f 67 | 72 61 70 68 79 7d 7b 30 |ebibliog|raphy}{0|
|000052f0| 7d 0a 20 20 5c 62 69 62 | 69 74 65 6d 7b 4c 65 47 |}. \bib|item{LeG|
|00005300| 61 6c 6c 39 31 7d 20 44 | 69 64 69 65 72 20 4c 65 |all91} D|idier Le|
|00005310| 47 61 6c 6c 2c 20 60 60 | 4d 50 45 47 2d 2d 41 20 |Gall, ``|MPEG--A |
|00005320| 56 69 64 65 6f 20 43 6f | 6d 70 72 65 73 73 69 6f |Video Co|mpressio|
|00005330| 6e 0a 20 20 53 74 61 6e | 64 61 72 64 20 66 6f 72 |n. Stan|dard for|
|00005340| 20 4d 75 6c 74 69 6d 65 | 64 69 61 20 41 70 70 6c | Multime|dia Appl|
|00005350| 69 63 61 74 69 6f 6e 73 | 2c 27 27 20 7b 5c 65 6d |ications|,'' {\em|
|00005360| 20 43 6f 6d 6d 75 6e 69 | 63 61 74 69 6f 6e 73 20 | Communi|cations |
|00005370| 6f 66 20 74 68 65 0a 20 | 20 20 20 41 43 4d 5c 2f |of the. | ACM\/|
|00005380| 7d 2c 20 41 70 72 69 6c | 20 31 39 39 31 2c 20 56 |}, April| 1991, V|
|00005390| 6f 6c 20 33 34 20 4e 75 | 6d 20 34 2c 20 70 70 2e |ol 34 Nu|m 4, pp.|
|000053a0| 20 34 36 2d 2d 35 38 2e | 0a 0a 20 20 5c 62 69 62 | 46--58.|.. \bib|
|000053b0| 69 74 65 6d 7b 50 61 74 | 65 6c 39 33 7d 20 4b 65 |item{Pat|el93} Ke|
|000053c0| 74 61 6e 20 50 61 74 65 | 6c 2c 20 42 72 69 61 6e |tan Pate|l, Brian|
|000053d0| 20 43 2e 20 53 6d 69 74 | 68 2c 20 61 6e 64 20 4c | C. Smit|h, and L|
|000053e0| 61 77 72 65 6e 63 65 20 | 41 2e 20 52 6f 77 65 2c |awrence |A. Rowe,|
|000053f0| 0a 20 20 60 60 50 65 72 | 66 6f 72 6d 61 63 65 20 |. ``Per|formace |
|00005400| 6f 66 20 61 20 53 6f 66 | 74 77 61 72 65 20 4d 50 |of a Sof|tware MP|
|00005410| 45 47 20 56 69 64 65 6f | 20 44 65 63 6f 64 65 72 |EG Video| Decoder|
|00005420| 27 27 2c 20 7b 5c 65 6d | 20 41 43 4d 20 4d 75 6c |'', {\em| ACM Mul|
|00005430| 74 69 6d 65 64 69 61 0a | 20 20 20 20 27 39 33 20 |timedia.| '93 |
|00005440| 43 6f 6e 66 65 72 65 6e | 63 65 7d 2e 0a 5c 65 6e |Conferen|ce}..\en|
|00005450| 64 7b 74 68 65 62 69 62 | 6c 69 6f 67 72 61 70 68 |d{thebib|liograph|
|00005460| 79 7d 0a 0a 5c 65 6e 64 | 7b 64 6f 63 75 6d 65 6e |y}..\end|{documen|
|00005470| 74 7d 0a | |t}. | |
+--------+-------------------------+-------------------------+--------+--------+